Google MAPS航路点 [英] Google MAPS waypoints
问题描述
我在Google Maps中使用航路点时遇到问题: https://developers.google.com/maps/documentation/javascript/directions#DirectionsResults
I have a problem using waypoints in Google Maps: https://developers.google.com/maps/documentation/javascript/directions#DirectionsResults
我想添加航点并按我提供的顺序获取行车路线,但是Google会自动对其进行优化...
I want to add waypoints and get driving directions in the order I provide them, but google automatically optimize them...
我使用以下代码发送请求:
I send request with this code:
var request = {
origin: start,
destination: end,
waypoints: waypts,
optimizeWaypoints: true,
travelMode: google.maps.TravelMode.DRIVING
};
在我的数组(路径)中,航路点按应有的顺序排序...
and in my array (waypts) waypoints are ordered as they should be ...
示例:
我想从纽约经芝加哥经费城到达费城..但是我得到的回应是这样的:纽约经NY(1米)到芝加哥至费城.Google以某种方式优化了路线,但我不希望这样做...
I want to go from NY via Chicago via NY to Philadelphia.. But the response I get is like this: NY via NY (1 meter) to Chicago to Philadelphia. Google somehow optimize route but I don't want this ...
有什么主意吗?
谢谢!
推荐答案
LOL ...我在文档中错过了这一点...解决方案是:
LOL ... I missed that in documentation... The solution is:
在var请求中添加以下行:
In var request put the line:
optimizeWaypoints: false
这篇关于Google MAPS航路点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!