asd123766
路人甲
路人甲
  • 注册日期2011-04-26
  • 发帖数1
  • QQ
  • 铜币106枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:3256回复:0

openlayers加载本地 google map的例子

楼主#
更多 发布于:2011-04-26 11:02
<P>openlayers加载本地 google map的例子</P>
<P>  function get_img_url(bounds)<BR>    {<BR>       var res = this.map.getResolution();<BR>       var bbox = this.map.getMaxExtent();<BR>       var size = this.tileSize<BR>       <BR>       var z = this.map.getZoom();<BR>       var x = Math.round ((bounds.left - bbox.left) / (res * size.w));<BR>       var y = Math.round ((bbox.top - bounds.bottom) / (res * size.h));<BR>        <BR>       var path;<BR>       if(x<0 || y<0)<BR>         path = "noMap.png";<BR>       else<BR>         path = "map/gm_"+x+"_"+y+"_"+z+".png";</P>
<P>        var url = this.url;<BR>        return url + path;<BR>    }</P>
<P>    function init()<BR>    {<BR>        var options = {<BR>            controls: [new OpenLayers.Control.MouseDefaults(),<BR>                       new OpenLayers.Control.MousePosition({element:$('position')}),<BR>                       new OpenLayers.Control.Scale($('scale'))],<BR>            numZoomLevels:13<BR>           };<BR>        map = new OpenLayers.Map('map', options);<BR>        var myMap = new OpenLayers.Layer.TMS("myMap TMS","Images/",{type:'png', getURL:get_img_url });<BR>        map.addLayer( myMap );<BR>        var point = new OpenLayers.LonLat(lon, lat);<BR>        map.setCenter ( point , 10 ); </P>


<P>纬度对应不起来, 求解</P>
喜欢0 评分0
游客

返回顶部