使用天地图api访问本地wms

来源:互联网 发布:淘宝信息管理系统 编辑:程序博客网 时间:2024/05/20 11:47

利用这种方法,可以在天地图上加上自己的图层,代码如下:

 

 var map;          
            function init(){
                var bounds = new GeoSurf.Bounds(
                   59.99166666666667,0.008333333333333304,152.49166666666667,90.00833333333334
                );
                var options = {
     units: 'degrees'
                };
                map = new GeoSurf.PortalMap('map', options);
                var ll = new GeoSurf.Layer.WMS(
                    "TerrainShade", "http://localhost:8080/geoserver/wms",
                    {
                        layers: 'wuhan:GG_TerrainShade',
                        tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom
                    },
                    {
                        buffer: 0,
      resolutions:[0.016666666666666666,0.033333333333333326,
                  0.06666666666666667,0.13333333333333333],
                        maxExtent: bounds,
                        displayOutsideMaxExtent: false
                    }
                );
    
                map.addLayer(ll);          
                map.zoomToExtent(bounds);
             
            }

原创粉丝点击