OpenLayers3-3-Tiled ArcGIS MapServer


原文地址:http://openlayers.org/en/v3.12.1/examples/arcgis-tiled.html

This example shows how to use an ArcGIS REST MapService as tiles. This source type supports Map and Image Services. For cached ArcGIS services, better performance is available by using ol.source.XYZ instead.

Related API documentation:
ol.Map,ol.View,ol.layer.Tile,ol.source.MapQuest,ol.source.TileArcGISRest

翻译:
这个例子演示了如何使用ArcGIS REST MapService作为切片。这个来源类型支持地图和图片服务。对于缓存的ArcGIS服务,更好的展现方式是使用ol.source.XYZ

相关的api文档包括:
ol.Map,ol.View,ol.layer.Tile,ol.source.MapQuest,ol.source.TileArcGISRest

<!DOCTYPE html>
<html>
  <head>
    <title>Tiled ArcGIS MapServer</title>
    <link rel="stylesheet" href="http://openlayers.org/en/v3.12.1/css/ol.css" type="text/css">
    <script src="http://openlayers.org/en/v3.12.1/build/ol.js"></script>
  </head>
  <body>
    <div id="map" class="map"></div>
    <script>
      var url = 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/' +
          'Specialty/ESRI_StateCityHighway_USA/MapServer';

      var layers = [
        //底图 osm, sat, hyb.
        new ol.layer.Tile({
          source: new ol.source.MapQuest({layer: 'sat'})
        }),
        //ArcGIS的切片
        new ol.layer.Tile({
          //ArcGIS的切图范围,主要坐标系
          extent: [-13884991, 2870341, -7455066, 6338219],
          source: new ol.source.TileArcGISRest({
            url: url
          })
        })
      ];
      var map = new ol.Map({
        layers: layers,
        target: 'map',
        view: new ol.View({
          center: [-10997148, 4569099],
          zoom: 4
        })
      });
    </script>
  </body>
</html>

转载自:https://blog.csdn.net/isowang/article/details/50526832

You may also like...

退出移动版