| Forum | GitHub | Maps | Blog

How to find the closest point on a street?


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…


GraphHopper does that in the LocationIndex.


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.


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