Rom*_*shy 7 javascript google-maps direction google-maps-api-3
路由只有在我使用LatLng或String参数时才会创建,但我需要通过PlaceId创建它,但它不起作用
例:
directionsService.route({
origin: {'placeId': 'ChIJc1lGdwfP20YR3lGOMZD-GTM'},
destination: {'placeId': 'ChIJdTGhqsbP20YR6DZ2QMPnJk0'},
waypoints: [{stopover: true, location: new google.maps.Place('ChIJRVj1dgPP20YRBWB4A_sUx_Q')}],
optimizeWaypoints: true,
travelMode: google.maps.TravelMode.DRIVING
}
Run Code Online (Sandbox Code Playgroud)
只需要将google.maps.Place对象作为航点位置传递.例如:
directionsService.route({
origin: { placeId: "ChIJc1lGdwfP20YR3lGOMZD-GTM" },
destination: { placeId: "ChIJdTGhqsbP20YR6DZ2QMPnJk0" },
waypoints: [{ stopover: true, location: { placeId: "ChIJRVj1dgPP20YRBWB4A_sUx_Q" } }],
optimizeWaypoints: true,
travelMode: google.maps.TravelMode.DRIVING
}
Run Code Online (Sandbox Code Playgroud)
location指定航点的位置,LatLng,google.maps.Place对象或将进行地理编码的String.
| 归档时间: |
|
| 查看次数: |
2379 次 |
| 最近记录: |