-1

Just want to verify this. I have checked Google Maps API, couldn't seem to find this one.

Bascially if I use Google Maps to calculate a route from point A to point B. I wonder if there is an API that Google provides to calculate what's the location/coordinate if you travel x meters following the route from point A?

Or I have to break down the routes returned by Google and calculate them one by one. I assume it would be something like:

var travelledDistance   
var routeDistanceTotal  
for route x in routes  
var routeDistanceTotal = routeDistanceTotal + (route x end - route x start)   
if( routeDistanceTotal >= travelledDistance) {  
    final location = point end - routeDistanceTotal - travelled distance 
}    
else{  
    continue to next route  
}

Thanks!

zhanke
  • 671
  • 7
  • 25
  • 1
    Similar to [this](http://www.geocodezip.com/v3_GoogleEx_directions-timeOnRoute.html)? – geocodezip Mar 22 '18 at 03:07
  • @geocodezip thanks for your help. Found https://stackoverflow.com/questions/19128954/latlng-from-polyline-percentage. the method GetPointAtDistance is exactly what I am after. Google doesn't have an official one, I am bit surprised. Anyway, thanks so much! – zhanke Mar 22 '18 at 08:51

1 Answers1

0

Found it!

GetPointAtDistance from http://www.geocodezip.com/scripts/v3_epoly.js.

From latLng from polyLine Percentage and thanks to @geocodezip

zhanke
  • 671
  • 7
  • 25