neo4j-contrib / java-rest-binding

Java Bindings for the Neo4J Server REST API, providing an implementation of GraphDatabaseService
Other
120 stars 72 forks source link

Spatial headache #52

Open fithisux opened 11 years ago

fithisux commented 11 years ago

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

jexp commented 11 years ago

A fully running failing test would be great. With correct example data.