1. 程式人生 > 實用技巧 >WMS服務載入二維地圖

WMS服務載入二維地圖

 var map,url = "http://127.0.0.1:8090/iserver/services/map-sz_airport/wms130/PL_WS";

    map = new SuperMap.Map("map", {
        controls: [
            new SuperMap.Control.ScaleLine(),
            new SuperMap.Control.Zoom(),
             new SuperMap.Control.MousePosition(),
            new SuperMap.Control.Navigation({
                dragPanOptions: {
                    enableKinetic: 
true } })] });  // projection選擇EPSG:4326,layers,version,maxExtent從url中找,注意maxExtent是先寫緯度,再寫經度 var wms1 = new SuperMap.Layer.WMS("WMS1", url, { layers: "PL_WS", version: '1.3.0' }, { projection: "EPSG:4326", maxExtent:
new SuperMap.Bounds(113.80437557691948,22.60912750231052,113.83200717398446,22.666431289558115) }); map.addLayers([wms1]); map.setCenter(new SuperMap.LonLat(113.81033,22.63892), 3);