Finding the closest point in a map (points and highways)

Hi everyone there,

i have created a marine osm (graph network) where “ways” are the edges of the graph.
One peculiar class of edges is the one which connects 2 points with longitude near -180 and near 180 respectively
(e.g. (-179,0.5) and (178,1) gps points).

And here is the issue:
when i select a random point in the map, it appears that this point is matched to an edge of the above peculiar class, which in the map appears as a straight line from the left to the right.

Any idea how i can fix this problem?
Is there a way to tell GraphHopper to always find the closest node and not edge of a (lat,lon) point that does not exist in the graph?

Thank you very much!

Arg, that is indeed a nice ‘edge case’ :wink:

You probably need to feed the location index with two splitted edges going from -179 to -180 and one from 180 to 178.

Maybe you can recreate this problem as a unit test failure?

Related discussion here: Waterways path possible? and fixed this bug here: