2012-04-27 1 views
4

Google지도 V3 API 웨이 포인트에 관해 많은 질문이 있지만 임의의 중간 지점에서 최적의 왕복 경로를 얻는 방법에 대해서는 다루지 않습니다. 기본적으로, weighpoint의 순서는 가장 최적의 경로가 무엇인지에 의해 결정되어야하며 반드시 시스템에 공급 된 순서에 따라 결정되지는 않습니다. 아무도 이것이 가능한지 알고 있습니까?Google지도 API V3 - 임의의 웨이 포인트를 통해 최적의 왕복 경로를 얻는 방법

답변

8

V3 API에 "최적화"옵션이 있습니다. 너 해봤 어?

optimizeWaypoints

https://developers.google.com/maps/documentation/javascript/reference에서
If set to true, the DirectionService will attempt to re-order the supplied 
intermediate waypoints to minimize overall cost of the route. If waypoints 
are optimized, inspect DirectionsRoute.waypoint_order in the response to 
determine the new ordering. 

optimizeWaypoints (optional) specifies that the route using the supplied 
waypoints may be optimized to provide the shortest possible route. 

첫 번째 문단.

두 번째부터 https://developers.google.com/maps/documentation/javascript/directions

+0

나는 그 옵션을 알아 채지 못했습니다. 감사! – VinnyD

+0

누군가 제한된 웨이 포인트 이상으로 이것을 수행하는 방법을 알고 있습니까? –