快捷搜索: 王者荣耀 脱发

Arcgis js api二次开发——加载国家天地图

<template>
  <div id="map-view"></div>
</template>

<script>
import SceneView from "@arcgis/core/views/SceneView";
import Map from "@arcgis/core/Map";
import WMTSLayer from "@arcgis/core/layers/WMTSLayer";
import Basemap from "@arcgis/core/Basemap";
export default {
  mounted() {
    this.init();
  },
  methods: {
    init() {
      const tk = ""; // 你申请的key
      const annaLayer = new WMTSLayer({
        url: "http://t0.tianditu.gov.cn/cva_c/wmts",
        customParameters: {
          tk: tk,
        },
      });
      const layer = new WMTSLayer({
        url: "http://t0.tianditu.gov.cn/img_c/wmts",
        customParameters: {
          tk: tk,
        },
      });

      let basemap = new Basemap({
        baseLayers: [layer,annaLayer],
      });
      const map = new Map({
        basemap: basemap
      });

      const view = new SceneView({
        container: "map-view",
        map: map,
      });
      console.log(view);
    },
  },
};
</script>
<style scoped>
#map-view {
  width: 800px;
  height: 800px;
}
</style>
经验分享 程序员 微信小程序 职场和发展