2012-09-17 59 views
0

可能重複:
Convert Google map v2 in to google map v3如何將GoogleMap API v2代碼轉換爲v3?

我的網站正在運行谷歌地圖API第2版。我想轉換爲新的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(); 
} 

回答