问题描述
只想验证一下.我已经检查过Google Maps API,似乎找不到这个.
尤其是如果我使用Google Maps计算从A点到B点的路线.我想知道,如果您沿着从A点出发的路线行驶x米,Google是否提供了API以计算位置/坐标?
或者我必须分解Google返回的路线,并一一计算.我认为那是这样的:
var travelledDistancevar routeDistanceTotal用于路线中的路线xvar routeDistanceTotal = routeDistanceTotal +(路线x终点-路线x起点)if(routeDistanceTotal> = travelledDistance){最终位置=点终点-routeDistanceTotal-行驶距离}别的{继续下一条路线}
谢谢!
找到了!
从 http://www.geocodezip.com/scripts/v3_epoly.js.来自来自polyLine Percentage的latLng ,并感谢@geocodezip
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!
Found it!
GetPointAtDistance from http://www.geocodezip.com/scripts/v3_epoly.js.
From latLng from polyLine Percentage and thanks to @geocodezip
这篇关于在Google Maps路线上旅行x距离后获取位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!