I am trying to do road snapping to the closest point on a road irrespective of the distance to the next road. To do the road snapping I am using
QueryResult queryResult = graphhopper.getLocationIndex().findClosest(latitude, longitude, EdgeFilter.ALL_EDGES);
When I try this for a location that is very far from my road network I get an IllegalStateException:
java.lang.IllegalStateException: Calculate snapped point before!
How can I ensure that findClosest(..)
always returns a point? I have looked around and got stuck somewhere in findClosest(..)
in the LocationIndexTree.java