2

I've been searching for this problem almost 2 days without any result I have found different questions in stackoverflow and neo4j groups but none of them fixed the problem(probably I'm doing something wrong?)

I recently downloaded neo4j 2.1.3 enterprise and tried to use withinDistance in cypher(Also tested in 2.0.1)

I found this question in stackoverflow and did peter's suggestion but nothing changed Neo4j Spatial 'WithinDistance' Cypher query returns empty while REST call returns data

The steps I do

Create the layer

POST http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer
{
            'layer': 'userPosition',
            'lat': 'latitude',
            'lon': 'longitude'
}

Create the index

POST http://localhost:7474/db/data/index/node
{
            'name': 'userPosition',
            'config[provider]': 'spatial',
            'config[geometry_type]': 'point',
            'config[lat]': 'latitude',
            'config[lon]': 'longitude'
}

Created a node with attributes longitude and latitude After that add the node to index

POST http://localhost:7474/db/data/index/node/userPosition
{
            'key': 'dummy',
            'value': 'dummy',
            'uri': 'http://localhost:7474/db/data/node/NODE_ID'
}

And at the end add the node to the layer

POST http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer
{
            'layer': 'userPosition',
            'node': 'http://localhost:7474/db/data/node/NODE_ID'
}

For testing I use lon, lat (1,1) Using findGeometriesWithinDistance by REST works but the cypher query using withinDistance doesn't work :(

Any help I'm really thinking about giving up on neo4j because of this :(

Community
  • 1
  • 1
PHP lover
  • 238
  • 2
  • 11
  • 2
    I think your index config is wrong, it should be a nested json array for the config details. – Michael Hunger Aug 03 '14 at 13:23
  • Did you actually create a node? You missed to post that create REST statement, and what is the NODE_ID that you use then? You don't have to add the node to the layer if you add it to the index and vice versa. – Michael Hunger Aug 03 '14 at 13:24
  • @MichaelHunger That was awesome, you really saved my day The problem was actually the config wasn't nested Thanks again – PHP lover Aug 03 '14 at 15:13
  • @MichaelHunger I'm not sure how I should close this question. Should I add an update or I have to do something else? :/ – PHP lover Aug 03 '14 at 15:21

0 Answers0