I am using the OSRM API to (1) determine the nearest point on a road segment from a give random point with
http://server:5000/nearest?loc=_lat_,_lon_
The returned coordinates are used then as an input to (2) determine the route between this point and an other give point on a road segment with
http://server:5000/viaroute?loc=_lat1_,_lon1_&loc=_lat2_,_lon2_
Every now and then the point determined in step (1) is located on a non routable road (e.g. private road).
I am looking for a way to work around this problem.
a) Is there a way to determine in step (1) the next closest point on a different road segment or only query road segments on routable roads.
or
b) Is there a way that the routing query in (2) automatically determines the next closest routable point?
I am also open for different solutions. However I am not interested in setting up my own server with pgrouting or similar services. I like to solve it with an open source routing API (preferable with the OSRM one).
The request is done from a python script (requests and json).
Best Answer
Do you need this functionality with a few via nodes (in this case I think there is a very similar Google API) or for a detailed track ( i.e. map-matching )? Otherwise you'll have to setup OSRM with a selection of roads instead of the full OSM.