GraphHopper.com | Forum | GitHub | Maps | Blog

Reverse geocoding to closest street intersection?


#1

I’d like to reverse geocode a coordinate to the closest street / intersection.

Via the LocationIndex the closest edge can be retrieved. Is there an option to retrieve the closest junction (and their edges), as well?

My use case is to derive a meaningful verbal description of a point close to a street (like e.g. Main Street at Tottenham Road). Only reverse geocoding to buildings may or may not return a good description, i.e. in case the point is close to intersections.


#2

You would get the base or adj node from the closest edge:

closestEdge.getBaseNode()

And then use this node to get all the edges.

ee = graph.createEdgeExplorer();
iter = ee.setBaseNode(node);
while(iter.next()) {
   iter.getName();
}

#3

Great! Thank you, Peter!