Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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).

share|improve this question
    
can you somehow avoid importing those 'unroutable' roads? –  Karussell Jun 7 '13 at 7:23
    
Well they are part of OSM. I only use an API and don't see a way how I could influence what is imported and what not. –  ustroetz Jun 7 '13 at 14:13
    
I understand. You could file a bug report IMO there. Also what area are you looking for? If it is rather small why not setup OSRM without the private roads? –  Karussell Jun 7 '13 at 18:32
    
It is not a real bug of OSRM. It does find the closest road (1). And private routes are not routable (2). The area are the states California, Oregon and Washington of the United States. It is a lot of work to setup OSRM yourself. I am hoping to bypass it this somehow. –  ustroetz Jun 7 '13 at 18:41
    
If the private roads are not routable then the location should not snap to those roads but that is my personal opinion. E.g. it also should not snap to foot path if the route is for CAR etc. –  Karussell Jun 7 '13 at 18:48

1 Answer 1

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.

share|improve this answer
    
Well via nodes is also possible with OSRM, but that does not solve the problem. Also I am not interested in setting up my own server with OSRM. I am hoping there is a workaround and I still can use the OSRM API. But thanks for your ideas. Maybe I switch to the Google API instead. –  ustroetz Jun 6 '13 at 20:45
1  
in OSRM you can use the zoom level &z={0,...,18} to "ignore small isolated islands". Otherwise an ugly hack is to add a small noise to your location data when the returned locations are on non-routable streets. –  Fabrice Marchal Jun 17 '13 at 9:02
    
Thanks for pointing that out. The small island isolatation isn't the problem. What exactly do you mean with adding small noise to my location data? –  ustroetz Jun 24 '13 at 16:54
    
if you want to work around the limitation of this snapping mechanism, you could add a few meters in any direction till you find a snapped-routable road. It's not nice but it won't block you waiting for the snapping to be fixed. Did the zoom level solve this? –  Fabrice Marchal Jun 27 '13 at 21:05
    
The zoom level doesn't solve the problem. But I understood you second point now with the small noise, but that is a pretty big and not so nice workaround of this problem. I guess I am better of setting up my own routing app. –  ustroetz Jun 27 '13 at 21:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.