Problem with findNClosest

When I use locationIndex.findNclosest, I set the radius to 20.0m, but it returns snapped points with distance more than 100.0m, why? How can I let it to only return the points within certain radius.

Please make sure to include the version of GraphHopper you are using. Current master no longer has this method.

The reason you get more results is that the location index search works ‘tile-based’, so it would not be more efficient to stop the search earlier. If you want to make sure your results do not exceed the given maximum radius, just filter the returned snaps after calling findNClosest.

If I change the number of loops to 1, the result is just within the given radius?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.