将其从Google Maps API v2转换为v3

时间:2011-05-27 13:41:34

标签: api google-maps layer

这适用于Google Maps API v2,现在如何将其转换为API v3? 谢谢

// - Radar 1 Overlay Tiles
var radar_layer= new GTileLayer(new GCopyrightCollection(""),1,17);
radar_layer.getTileUrl=function(tile,zoom) {
        var llp = new GPoint(tile.x*256,(tile.y+1)*256);
        var urp = new GPoint((tile.x+1)*256,tile.y*256);
        var ll = G_NORMAL_MAP.getProjection().fromPixelToLatLng(llp,zoom);
        var ur = G_NORMAL_MAP.getProjection().fromPixelToLatLng(urp,zoom);
        var dt = new Date();
        var nowtime = dt.getTime();
        var tileurl = "http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?&request=GetMap&service=WMS&version=1.1.1&LAYERS=nexrad-n0r&styles=";
        tileurl+="&format=image/png&bgcolor=0x333333&transparent=true&srs=EPSG:4326&bbox="+ll.x+","+ll.y+","+ur.x+","+ur.y;
        tileurl+="&width=256&height=256&reaspect=false&cachetime="+nowtime;

    return tileurl;
};
radar_layer.getOpacity = function() {return 0.6;}
radar_layer.isPng = function() {return true;}
radaroverlay = new GTileLayerOverlay(radar_layer);
map.addOverlay( radaroverlay );
radarShown = true;

1 个答案:

答案 0 :(得分:3)

也许你可以从这开始:Tips for Upgrading Gmaps v2 to v3 more quickly

然后,如果这不能满足您的需要,请编辑您的问题以发布您当时的内容,并且有人可以尝试修复它。