# 一.TileArcGISRest

  • ol.source.TileArcGISRest,ArcGIS Rest 服务提供的切片数据,继承自 ol.source.TileImage

# 1.ArcGIS瓦片图

图层 layer source 备注
layer1 Tile OSM -
layer2 Tile TileArcGISRest "https://sampleserver.arcgisonline.com/ArcGIS/rest/services/" +"Specialty/ESRI_StateCityHighway_USA/MapServer"

瓦片形式的 ArcGIS REST MapService,数据源的类型支持地图和图像服务,为了缓存 ArcGIS 服务,使用 ol.source.XYZ 能够获得更好的性能

查看代码详情
<template>
  <div ref="map" class="map"></div>
</template>

<script>
export default {
  mounted() {
    let {
      Map,
      View,
      layer: { Tile: TileLayer },
      source: { OSM, TileArcGISRest },
    } = ol
    const url =
      "https://sampleserver.arcgisonline.com/ArcGIS/rest/services/" +
      "Specialty/ESRI_StateCityHighway_USA/MapServer"

    const layers = [
      new TileLayer({
        source: new OSM(),
      }),
      new TileLayer({
        extent: [-13884991, 2870341, -7455066, 6338219],
        source: new TileArcGISRest({
          url: url,
        }),
      }),
    ]
    const map = new Map({
      layers: layers,
      target: this.$refs.map,
      view: new View({
        center: [-10997148, 4569099],
        zoom: 4,
      }),
    })
  },
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38