从谷歌地图API V2将其转换为V3 [英] Convert this from Google Maps API v2 to v3

查看:309
本文介绍了从谷歌地图API V2将其转换为V3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这适用于谷歌地图API第2版,现在我该如何将它转换为API第3版?
谢谢

  //  - 雷达覆盖1瓷砖
变种radar_layer =新GTileLayer(新GCopyrightCollection(),1,17);
radar_layer.getTileUrl =功能(瓦,变焦){
        变种LLP =新GPoint(tile.x * 256,(tile.y + 1)* 256);
        变种URP =新GPoint((tile.x + 1)* 256,tile.y * 256);
        VAR LL = G_NORMAL_MAP.getProjection()fromPixelToLatLng(LLP,变焦)。
        VAR UR = G_NORMAL_MAP.getProjection()fromPixelToLatLng(URP,变焦)。
        变种dt的=新的日期();
        变种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 =假放; cachetime =+ nowtime;    返回tileurl;
};
radar_layer.getOpacity =函数(){返回0.6;}
radar_layer.isPng =函数(){返回true;}
radaroverlay =新GTileLayerOverlay(radar_layer);
map.addOverlay(radaroverlay);
radarShown = TRUE;


解决方案

也许你可以用这个启动:<一href=\"http://stackoverflow.com/questions/3901817/tips-for-upgrading-gmaps-v2-to-v3-more-quickly\">Tips对于升级GMaps实现V2更迅速地V3

然后,如果不把你带到任何你需要去编辑你的问题后,你必须在这一点什么,有人可以尝试修复它。

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;

解决方案

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.

这篇关于从谷歌地图API V2将其转换为V3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆