0

I am loading my OSM data to graph database. I created a layer (simple point layer) on top of it to load all the points from the graph db. After adding all the points to the layer, I am able to find closest points in a certain kilometer distance. But I am not able to figure out an option which will give me the points before and after a specific point in a way. Can you please give me some clue to solve this problem?

passionate
  • 503
  • 2
  • 7
  • 25
  • BTW: everything that include nearest neighbour or routing could be solved also with the open source routing engine GraphHopper (note: I'm one of authors) – Karussell Jan 09 '17 at 17:43

1 Answers1

0

If you used the OSM importer that is available with Neo4j Spatial there will be a :NEXT relationship connecting the nodes in a way. So you can traverse the nodes (points) by following the :NEXT relationships. For example:

// find node within 1m of a point
CALL spatial.withinDistance('geom',
{latitude: 37.563440, longitude: -122.322265}, 1) YIELD node AS p
// traverse graph to find next point in the way
MATCH (p)-[:NEXT]->(nextPoint)
RETURN nextPoint
William Lyon
  • 8,371
  • 1
  • 17
  • 22