gpt4 book ai didi

google-maps - 谷歌地图 API : How to draw shortest plane path between two geo-points?

转载 作者:行者123 更新时间:2023-12-04 14:03:53 25 4
gpt4 key购买 nike

我需要在 map 上绘制最短的平面路径。
我在 Google Earth 中创建了 KML,并将 int 加载到 Google Map。正如您所看到的附加图像:路径非常不同:Google Vap 路径更长。
如何在谷歌地图上绘制圆弧路径?

Path in Google Earth
Same path in Google Map

最佳答案

在 V3 中,只需添加 geodesic: true选择您的折线。

演示 http://jsfiddle.net/yV6xv/20/单击 map 以定义路径端点

    var myLine = new google.maps.Polyline({
map: map,
geodesic: true
});

var path = [];

google.maps.event.addListener(map, 'click', function(event) {
new google.maps.Marker({map:map,position:event.latLng});
path.push(event.latLng);
myLine.setPath(path);
});

result from demo

关于google-maps - 谷歌地图 API : How to draw shortest plane path between two geo-points?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10959473/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com