Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
565 views
in Technique[技术] by (71.8m points)

geolocation - Get exact geo coordinates along an entire route, Google Maps or OpenStreetMap

Suppose I have a route defined from one town to another. From the Google Maps API I can recover a route between the two. However, the route returned from Google is a driving route that includes geo-coordinates only at places where there is another step in a leg (for example, where I have to turn from one highway to another).

What I need is geo-locations (lat/long) along the entire route, at specific intervals (for example, every 1/4 mile or 100m).

Is there a way to accomplish this via the Google Maps API / web services?

Or would the OpenStreetMap database be the way to do it?

Kind regards, Madeleine.

question from:https://stackoverflow.com/questions/16711350/get-exact-geo-coordinates-along-an-entire-route-google-maps-or-openstreetmap

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

OSRM gives you routes with road geometries as they are in the OpenStreetMap database. For example, you can get the route as GPX (and post-process this file if you want). This would look like the following:

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

Read more: OSRM API docs.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...