首页/GIS/列表

openlayer/openlayer3加载超图WMS图层例子(LAYERS对应值填的是name属性)【测试成功

来源:  2018-04-19 08:44:39    评论:0点击:

openlayer/openlayer3加载超图WMS图层例子(LAYERS对应值填的是name属性)
代码如下:


<!doctype html>
<html lang="en">
  <head>
    <link rel="stylesheet" href="https://openlayers.org/en/v4.6.5/css/ol.css" type="text/css">
    <style>
      .map {
        height: 400px;
        width: 100%;
      }
    </style>
    <script src="https://openlayers.org/en/v4.6.5/build/ol.js" type="text/javascript"></script>
    <title>OpenLayers example</title>
  </head>
  <body>
    <h2>My Map</h2>
    <div id="map" class="map"></div>
    <script type="text/javascript">
    var layers = [  
          
          new ol.layer.Tile({  
              //extent: [117.909832, 24.427347, 118.346327, 24.792678],  
              source: new ol.source.TileWMS({  
 
                  url: 'http://172.19.36.119:8090/iserver/services/map-china400/wms111/China_4326',  
                  params: { 'LAYERS': '0', 'singleTile': true }  
                   
              })  
          })  
        ];  
        var map = new ol.Map({  
            layers: layers,  
            target: 'map',  
            view: new ol.View({  
                center: [118, 24.5],  
                zoom: 12,  
                projection: "EPSG:4326"  
            })  
        });     
    </script>
  </body>
</html>

为您推荐

友情链接 |九搜汽车网 |手机ok生活信息网|ok生活信息网|ok微生活
 Powered by www.360SDN.COM   京ICP备11022651号-4 © 2012-2016 版权