Convert this from Google Maps API v2 to v3

十年热恋 提交于 2019-12-10 17:11:19

问题


This works on Google Maps API v2, now how do I convert this to API v3? Thanks

// - 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:


Perhaps you can start with this: Tips for Upgrading Gmaps v2 to v3 more quickly

Then, if that doesn't get you where you need to go, edit your question to post what you have at that point and someone can try to fix it.



来源:https://stackoverflow.com/questions/6153051/convert-this-from-google-maps-api-v2-to-v3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!