Point snapping - nearest location on edge not nearest node

Kia ora,

I’m in need of a means to snap an arbitrary point in space to the nearest location on an OSM graph, be it the nearest node/vertex (the default snapping behaviour) or the nearest point along the nearest edge.

This is important when we have two arbitrary points near but on opposite sides of the same node. For my purposes, I can’t assume the traversal time between the two arbitrary points is zero.

Is this possible in ORS?

Ngā mihi,


this is already the behavior of the openrouteservice - have a look at this example request.

You can move the starting point to anywhere along the corresponding road and it’ll start at that exact point.

Best regards

This is excellent to know, thank you, jschnell. This is a phenomenal resource.

Using this example, I have refined the source of my anomoly: two different geographic points snapping to the same address (which ORS seems to use during routing?). See the attached example to highlight this.

I.e. while they might snap to different points along the edge, they are so close that they end up referring to the same address, and thus return a traversal time of zero.

Question: is it possible to change the routing behaviour to exact edge points, away from using addresses?

This is not an error, simply important for me to identify the cause. I appreciate you helping me do so.



no, this is an unfortunate visual bug in the client.
If you look at the network tab in your browser’s developer tools, you’ll see that

  • different coordinates are being sent as start and end points
  • there is a non-zero answer

The addresses displayed stem from a reverse geocoding request and the two points correctly resolve to the same adress - yet, the coordinates are different and correctly sent to the openrouteservice.

Best regards

Acknowledged. My naïveté with ORS has led to a misunderstanding of what my problem actually is.

Instead, my distinct source and target points snap to the same geographic location on the graph. However, that point is not necessarily the nearest edge on the graph to either point.

I have created a new thread for this question to keep your forum tidy.