使用引入的依赖创建一个新地图

import mapboxgl from 'mapbox-gl'
// import '@supermap/iclient-mapboxgl' // 后续调用一些超图的方法按需引入

let map = new mapboxgl.Map({
  container: 'map',
  style: {
    "version": 8,
    "sources": {
      "raster-tiles": {
        "type": "raster",
        "tiles": ['https://iserver.supermap.io/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?z={z}&x={x}&y={y}'],
        "tileSize": 256
      }
    },
    "layers": [{
      "id": "simple-tiles",
      "type": "raster",
      "source": "raster-tiles",
      "minzoom": 0,
      "maxzoom": 22
    }]
  },
  center: [120.12, 30.16], // 地图初始中心点
  zoom: 10 // 地图初始缩放级别
})
Copyright © lujiannb@qq.com 2021 all right reserved,powered by Gitbook该文章修订时间: 2024-06-06 11:32:07

results matching ""

    No results matching ""