2012-09-17 6 views
0

가능한 중복 :
Convert Google map v2 in to google map v3어떻게 GoogleMap API v2 코드를 v3로 변환 할 수 있습니까?

내 사이트가 현재 Google지도 API v2가 실행 중입니다. 새 Google지도 API v3으로 변환하고 싶습니다. 다음 코드에서 변경해야 할 사항은 무엇입니까? 최근에 v2가 비활성화되었다는 메시지를 받았습니다. 그래서 현재의 기능으로 기존 스크립트를 수정해야합니다.

var maprecent; 
function init_maprecent() { 
function createMarker(point, myHtml) { var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { maprecent.openInfoWindowHtml(point, myHtml, {maxWidth:200}); }); return marker; } 
var markerindex = 0; var markers = new Array(); 
function animate_marker() {if (markerindex==markers.length) {markerindex=0;} GEvent.trigger(markers[markerindex], "click"); markerindex++; setTimeout(animate_marker, 5000);} 
var bottomLeft = new GControlPosition(G_ANCHOR_BOTTOM_LEFT); 
maprecent = new google.maps.Map(document.getElementById("smallmaprecent")); 
maprecent.addControl(new GSmallZoomControl()); 
maprecent.addControl(new GMapTypeControl(), bottomLeft); 
maprecent.setCenter(new GLatLng(34.051072,-118.259961), 5); 


var m0 = createMarker(new GLatLng(34.016919,-118.5010608), '<b>test</b><br>demo<br><a href=http://www.abcd.com/project_47_test.html>View project</a><br>London '); 
maprecent.addOverlay(m0); 
markers.push(m0); 
maprecent.addOverlay(new GPolygon([new GLatLng(34.016919,-118.5010608), new GLatLng(34.016919,-118.5010608), new GLatLng(34.016919,-118.5010608), new GLatLng(34.016919,-118.5010608), new GLatLng(34.016919,-118.5010608)], "#000000", 1, 0.5, "#444488", 0.1)); 
animate_marker(); 
} 

답변

1

V2는 사용할 수 없습니다. 2013 년 5 월에 사용 중지 될 수 있음을 의미하는 비추천입니다. 기본적으로 코드를 다시 작성해야합니다. V2와 V3 사이에 1-1 매핑이 없기 때문에 코드는 매우 다릅니다. 여기에서 문서를 확인하십시오. https://developers.google.com/maps/documentation/javascript/

관련 문제