다른 대륙에 플롯되지 않습니다구글 맵 API 내가 구글지도 방법의 포인트를 플롯하기 위해 구글 맵 API를 사용했다
나는 다음 페이지 참조 : 사용
https://developers.google.com/maps/documentation/javascript/directions
' Waypoints in Routes section '을 선택하고지도에서 3 점만 플롯하도록 조금 수정했습니다. 다음은 자바 스크립트 코드입니다.
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
var initialloc = new google.maps.LatLng(12.971599, 77.594563);
var mapOptions = {
zoom : 6,
mapTypeId : google.maps.MapTypeId.ROADMAP,
center : initialloc
}
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
directionsDisplay.setMap(map);
calcRoute();
}
function calcRoute() {
var lat = new Array();
var lon = new Array();
var start = new google.maps.LatLng(12.971599,77.594563);
var mid = new google.maps.LatLng(12.971558,77.594552);
var end = new google.maps.LatLng(12.971558,77.594552);
var waypts = [];
waypts.push({
location : mid,
stopover : true
});
var request = {
origin : start,
destination : end,
waypoints : waypts,
optimizeWaypoints : true,
travelMode : google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(
request,
function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
var route = response.routes[0];
}
});
}
3 개국이 동일한 국가 내에있는 경우 완벽하게 작동합니다. 즉, 로드맵을 가지고 있습니다.
내 질문은 위치가 다른 대륙 (예 : 인도 및 호주)에있을 때지도를 플로팅하는 방법입니다.
아무도 도와 줄 수 있습니까? 사전에
감사합니다.
인도에서 오스트레일리아로 운전 경로를 얻을 수 있기를 기대하는 이유는 무엇입니까? – geocodezip
그 밖의 방법 –
두 대륙간에 폴리 라인을 그리는 것이 목표 인 경우 길 찾기 서비스 ('길 찾기'를 반환 함)는 잘못된 것입니다. google.maps.Polyline을 사용하십시오. – geocodezip