Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Spatial headache #52

@fithisux

Description

@fithisux

Hi I deploy on an 1.9.1 neo4j server on ubuntu x64 13.04 with latest server plugin

neo4j-spatial-0.11-neo4j-1.9-server-plugin.zip

I put data with parameters both lat/lon equal to 5

and I do a query within distance with x=y=5 and radius 10

The snippet of creation of index

Index<Node> spatialindex;

 if(!index.existsForNodes("layer1"))
        {
            spatialindex = index.forNodes("layer1",SpatialIndexProvider.SIMPLE_POINT_CONFIG);            

        }
        else
        {
            spatialindex=index.forNodes("layer1");
        }

The snippet of addition

Node v = this.bgr.gds.createNode(); //creation
v.setProperty("lat", pkg.latitude);
v.setProperty("lon", pkg.longitude);
this.spatialindex.add(v,"dummy","value");

The snippet for searching

public Iterator<Node> queryPackagesSpatial(BiopolisSpatialQuery sq)
    {
        HashMap<String, Object> params = new HashMap<String, Object>();
        params.put(LayerNodeIndex.POINT_PARAMETER, new Double[]{sq.longitude,sq.latitude} );
        params.put(LayerNodeIndex.DISTANCE_IN_KM_PARAMETER, sq.radius);
        return this.bgr.pkg_mgmnt.spatialindex.query(LayerNodeIndex.WITHIN_DISTANCE_QUERY,params);
    }

It returns nothing. The snippets work on the client side

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions