2012-01-02 3 views
0

이것은 간단해야하지만 나에게는 적합하지 않아야합니다. 표시된 방향은 모두 b 지점 (끝)을 제외하고는 정상적으로 작동합니다. b 표시는 781-815 카운티 도로 555를 표시하지만 4011 Kings 고속도로를 표시해야합니다. 다음 코드에서운전 방향 수정하기 Gmaps V3

directionsDisplay.setPanel(document.getElementById('directions-panel')); 

781-815 카운티 도로 555를 대체하고 킹스 하이웨이 주소를 표시 할 수있는 방법이 있습니까? 나는 내가 생각할 수있는 모든 것을 봤어.하지만 내가 알 수있는 것은 Object Object 뿐이다. 어떤 도움을 주셔서 감사합니다.

+0

나는 그것을 알아 냈다. 만들려면 directions2Display = new google.maps.DirectionsRenderer(); 그런 다음 Json 라이브러리 파일을 추가했습니다. var string = JSON.stringify (응답); var newString = string.replace ("Turn", "Drive"); myDirections = JSON.parse (newString); directions2Display.setDirections (myDirections); directions2Display.setPanel (document.getElementById ('directions-panel'))); 오류가 없으면 하나의 조치가 취해질 것입니다. –

답변

1

알아 냈습니다. 생성

directions2Display = new google.maps.DirectionsRenderer(); 

는 그런 다음 JSON lib 디렉토리 파일

var string = JSON.stringify(response); 
    var newString = string.replace("Turn", "Drive"); // replace what you need here 
    myDirections = JSON.parse(newString); 
    directions2Display.setDirections(myDirections); 
    directions2Display.setPanel(document.getElementById('directions-panel')); 

없음 오류를 추가하고 치료를 작동합니다. -

+0

용액에 대한 축하. 가능한 경우 왼쪽의 체크 표시를 사용하여 대답을 '수락 함'으로 표시하십시오. 이렇게하면 다른 사용자에게 문제가 해결되었음을 알려주고 성공 사례를 통해 학습 할 수 있습니다. 건배 ~ –

+0

이것은 내가 찾고있는 해결책이었고 시도했지만지도 API에서이 오류를 보여줍니다. "오류 : TypeError : g [Lb]가 함수가 아닙니다." – Chris