openlayer2 加载arcgis server发布的wms,底图使用高德地图


<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0″>
<meta name=”apple-mobile-web-app-capable” content=”yes”>
<title>OpenLayers MapQuest Demo</title>
   <!–  <link rel=”stylesheet” type=”text/css” href=”style.css”/> –>

    <style type=”text/css”>
        html, body, #map{
            padding:0;
            margin:0;
            height:100%;
            width:100%;
        }
    </style>
    <script type=”text/javascript” src=”OpenLayers.js”></script>
    <script type=”text/javascript”>
        var map;
        function init(){
            var vecLayer = new OpenLayers.Layer.XYZ(“高德矢量”, [
                “http://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x=${x}&y=${y}&z=${z}”,
                “http://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x=${x}&y=${y}&z=${z}”,
                “http://webrd03.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x=${x}&y=${y}&z=${z}”,
                “http://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x=${x}&y=${y}&z=${z}”
            ], {
                isBaseLayer: true,
                visibility: true,
                displayInLayerSwitcher: true
            });
            var imgLayer = new OpenLayers.Layer.XYZ(“高德栅格”, [
                “http://webst01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=6&x=${x}&y=${y}&z=${z}”,
                “http://webst02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=6&x=${x}&y=${y}&z=${z}”,
                “http://webst03.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=6&x=${x}&y=${y}&z=${z}”,
                “http://webst04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=6&x=${x}&y=${y}&z=${z}”
            ], {
                isBaseLayer: true,
                visibility: true,
                displayInLayerSwitcher: true
            });

            map = new OpenLayers.Map(“map”,{
                projection: “EPSG:3857”,
                displayProjection: “EPSG:4326”,
                units: ‘m’,
                layers: [vecLayer, imgLayer],
                numZoomLevels:20,
                center: [12958238.665397, 4882368.6569168],
                zoom: 9
            });
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.addControl(new OpenLayers.Control.MousePosition());

map.addControl(new OpenLayers.Control.ScaleLine());
map.addControl(new OpenLayers.Control.Scale);


           var wms = new OpenLayers.Layer.WMS(
             “GPS”,
             “http://192.168.106.33:6080/arcgis/services/OpenlayerPoint/MapServer/WMSServer”,   
             {
             LAYERS: “2”,
             transparent:true
             },
             {
             singleTile: false,
             ratio: 1,
             isBaseLayer: false,
             visibility:true,
             yx : {‘EPSG:4326’ : true}
            }
             );
var wms1 = new OpenLayers.Layer.WMS(
             “导线点”,
             “http://192.168.106.33:6080/arcgis/services/OpenlayerPoint/MapServer/WMSServer”,   
             {
             LAYERS: “1”,
             transparent:true
             },
             {
             singleTile: false,
             ratio: 1,
             isBaseLayer: false,
             visibility:true,
             yx : {‘EPSG:4326’ : true}
            }
             );
 var wms2 = new OpenLayers.Layer.WMS(
             “水准点”,
             “http://192.168.106.33:6080/arcgis/services/OpenlayerPoint/MapServer/WMSServer”,   
             {
             LAYERS: “0”,
             transparent:true
             },
             {
             singleTile: false,
             ratio: 1,
             isBaseLayer: false,
             visibility:true,
             yx : {‘EPSG:4326’ : true}
            }
             );
            map.addLayer(wms);
map.addLayer(wms1);
map.addLayer(wms2);
        }
    </script>
</head>
<body onload=”init()”>
    <div id=”map”></div>
</body>

转载自:https://blog.csdn.net/wk2133/article/details/70844473

You may also like...

退出移动版