2013-08-01 2 views
1

현재 Google지도 API를 사용하여 길 찾기를 렌더링하고 있습니다. 기술적 인 측면 모두에서 Google지도에서 잘못된 방향을 제안합니다.

잘 작동합니다 :
var $canvas = $element.querySelector('#map-canvas'); 

vvar map = new maps.Map($canvas, { 
    center: new maps.LatLng(52.46004869999999, 13.37898690), 
    mapTypeId: maps.MapTypeId.ROADMAP, 
    zoom: 14 
}); 

var route = { 
    travelMode: google.maps.TravelMode.BICYCLING, 
    origin: new google.maps.LatLng(52.455833, 13.322948), 
    destination: new google.maps.LatLng(52.459281, 13.356367), 
}; 

new google.maps.DirectionsService().route(route, function(body) { 
    var display = new google.maps.DirectionsRenderer(); 

    display.setMap(map); 
    display.setDirections(body); 
}); 

불행하게도 제안 된 경로가 절대적으로 쓰레기입니다. A에서 B로 직접가는 대신 도시를 떠납니다 ...

이 기능은 maps.google.com과 잘 작동하지만 API가 아닌 이유는 무엇입니까? 올바른 결과를 얻으려면 무엇을 변경해야합니까?

보도

답변

0

기원은 기차역에 배치, 가능한 차량 배송이 때문에하려면 DirectionsService이 기차에 차를 넣어 제안 보인다.

Google지도는 정확한 출처를 사용하지 않으며, LatLng을 지오 코딩하고 "street_address"유형의 결과를 가져온 것으로 보입니다 (Berlinickestraße 16A, 12165 Berlin, Deutschland).

당신은 동일한 기능을 수행 할 수있다 (지오 코딩 된 LatLng의 제 출발지와 목적지로 street_address의 유형과 결과를 사용)

+0

대답 주셔서 감사합니다! 내가 원산지와 목적지의 유형을 거리 주소로 설정할 수있는 곳을 이해하지 못합니까? 지오 코드 응답에 street_address 유형의 결과가 없습니다 (기차역 만 다른 결과는 전혀 일치하지 않습니다) –

+0

http://gmaps-samples-v3.googlecode.com/svn/trunk/geocoder/v3-geocoder- tool.html # q % 3D52.455833 % 2C13.322948, 두 번째 결과는 Berlinickestraße 16A이고 street_address로 설정된 유형이 있습니다. –

관련 문제