GraphHopper.com | Forum | GitHub | Maps | Blog

How to find the closest point on a street?


#1

Hi there!

How can I find the closest point (from another one) on a street? When you calculate a route using GraphHopper, it finds the closest point (from the start point of the route) such that it is on a street, so how can I do that?

Thanks in advance…


#2

GraphHopper does that in the LocationIndex.


#3

Yes, I know I can do this:

QueryResult rua = hopper.getLocationIndex().findClosest(latitude, longitude, EdgeFilter.ALL_EDGES);

but how can I use QueryResult to get the closest point? Thanks for the replay.


#4

Have you looked into the QueryResult class? It contains many properties, like the closest edge, node, and also coordinates of the snapped position.