Control the snapping tolerance.

snap_tolerance

One interesting requirement which we have been asked again and again by the openrouteservice community is to implement means of control in regards to the snapping tolerance to the underlying street network. Sounds complicated but it isn’t. Well, by default our engine will look for the next street segment within a 50 kilometer radius. You might have noticed this behaviour on openrouteservice.org – add a waypoint that doesn’t necessarily lie on the road – which yet can be used to compute a route. This can now be controlled by you by using the radiuses parameter in your request (please be aware that this list length must correspond to the number of waypoints)!

Let’s give this a try by setting radiuses to 500 meters for each waypoint – perfect, it will find a route:

https://api.openrouteservice.org/directions?api_key=XY&coordinates=10.80874,50.74994|10.890477,50.720223&radiuses=500|500&profile=driving-car&preference=fastest&units=m&language=en

And now we will decrease to 50 meters, aha, it will respond with Cannot find point 1: 50.720223,10.890477 within a radius of 50.0 meters!

https://api.openrouteservice.org/directions?api_key=XY&coordinates=10.80874,50.74994|10.890477,50.720223&radiuses=50|50&profile=driving-car&preference=fastest&units=m&language=en

Happy routing!