[英]Get the waypoints of an alternative route with google maps api
Till version 3.27 of the google maps javascript api you can get the waypoints by looping through the via_waypoints-Array of the leg-Objects of the alternative route. 直到版本3.27的谷歌地图javascript api你可以通过循环通过替代路线的腿 - 对象的via_waypoints-Array获得路点。
The problem is that the via_waypoints-attribute for alternative routes in the direction response is now deprecated , so there is IMHO no (easy) way of getting the alternative/discriminating waypoints and therefore no way of requesting the alternative route or list the waypoints of the resulting route. 问题是方向响应中替代路线的via_waypoints-属性现在已被弃用 ,因此IMHO没有(简单)方式获得替代/区分航点,因此没有办法请求替代路线或列出航路点结果路线。
Is there a way to get somehow the waypoints of the alternative route? 有没有办法以某种方式获得替代路线的路点?
Any thoughts, any ideas? 任何想法,任何想法? thanks in advance
提前致谢
Unfortunately, I don't see any other way of getting these waypoints than following the suggestion of Google: 不幸的是,除了遵循Google的建议,我没有看到任何其他获取这些航点的方法:
Version 3.27 will be the last version of the API that supports via_waypoints in alternative routes.
版本3.27将是支持替代路由中的via_waypoints的API的最后一个版本。
The recommended approach is to request alternative routes, then display all routes as non-draggable plus the main route as draggable.
建议的方法是请求备用路由,然后将所有路由显示为不可拖动,并将主路由显示为可拖动。 Users can drag the main route until it matches an alternative route.
用户可以拖动主路线,直到它与备用路线匹配。 The via_waypoints field is available on the resulting route (dragged by the user).
via_waypoints字段在结果路径上可用(由用户拖动)。
As from version 3.27+ the alternative routes won't be returned, I suggest you to either make seperate requests for the alternative routes or to switch to another directions service provider. 从版本3.27+开始,将不会返回备用路由,我建议您对备用路由单独请求或切换到其他路线服务提供商。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.