Google maps api 3 Maps Api:latlng阵列中的DirectionRenderer

Google maps api 3 Maps Api:latlng阵列中的DirectionRenderer,google-maps-api-3,maps,Google Maps Api 3,Maps,我有一个latlng对象数组 我想沿此阵列中的点显示DirectionsRenderer。 创建DirectionsRenderer时,似乎只能将DirectionsResult作为方向。向DirectionsService发送一个DirectionsRequest,其中包含起点、终点,然后将所有其他LatLng对象作为航路点。(您需要将它们放在DirectionsWaypoint对象中。)如果您的LatLng对象对应于沿道路或其他道路的真实路线,则应该从DirectionService返回与L

我有一个latlng对象数组

我想沿此阵列中的点显示DirectionsRenderer。
创建DirectionsRenderer时,似乎只能将DirectionsResult作为方向。

向DirectionsService发送一个DirectionsRequest,其中包含起点、终点,然后将所有其他LatLng对象作为航路点。(您需要将它们放在DirectionsWaypoint对象中。)如果您的LatLng对象对应于沿道路或其他道路的真实路线,则应该从DirectionService返回与LatLng对象数组匹配的路线a DirectionsResult


如果您希望使用DirectionsRenderer绘制任意线条,而不是Google Maps可能提出的路线,那么您可能应该考虑其他方法。您认为DirectionsRenderer需要接收DirectionsResult对象是正确的。您为阻止该要求而做的任何事情都可能迟早会引起头痛。

顺便说一句,我不使用多段线,因为我希望它是可拖动的。谢谢您的回答。我尝试了航路点,但我在阵列中有许多点。我只能有8个航路点。我正在做的路线超过100公里,所以它们可以包含很多点。