3
votes

I've been trying to get a list of co-ordinates in a route from point A to B using OSRM with the following request:

GET http://router.project-osrm.org/viaroute?hl=en&loc=47.064970,15.458470&loc=47.071100,15.476760

However, on opening the url, i find the 'via_points' tag containing only two co-ordinates. Surely, that can't be the entire route? Anything I'm missing here? Is there any other way of generating the list of route co-ordinates with OSRM? Thanks

1
Please use the new API. The old endpoint will be deprecated soon. What you want is result.routes[0].overview with paramaters overview=full and then decode with github.com/mapbox/polyline - themarex

1 Answers

1
votes

The route is contained in the route_geometry object. It is an encoded polyline. If you don't want to uncompress it yourself you can disable compression via compression=false:

http://router.project-osrm.org/viaroute?compression=false&hl=en&loc=47.064970,15.458470&loc=47.071100,15.476760

Not sure what the via_points contains. OSRM's documentation seems to be outdated. Maybe they are just your start and end points snapped to the nearest road or something similar.