美文网首页
vue + SuperMap iClient(Leaflet)

vue + SuperMap iClient(Leaflet)

作者: 子夜照弦歌 | 来源:发表于2021-04-08 17:50 被阅读0次
官方文档 :https://iclient.supermap.io/examples/leaflet/examples.html#iServer
Leaflet文档:https://leafletjs.com/reference-1.7.1.html

安装依赖:

  npm install @supermap/iclient-leaflet

main.js全局引入

  import 'leaflet/dist/leaflet.css'
  import '@supermap/iclient-leaflet'
  import 'leaflet/dist/leaflet'

创建map

<template>
  <div>
    <div id="mapView" style="width: 100%; height: 500px"></div>
  </div>
</template>
     import L from "leaflet";

      var host = "https://iserver.supermap.io";
      var map,
        url = host + "/iserver/services/map-china400/rest/maps/China_4326",
        map = L.map("mapView", {
          crs: L.CRS.EPSG4326,
          center: [39.914714, 116.383572],
          maxZoom: 18,
          zoom: 11,
        });
      L.supermap.tiledMapLayer(url).addTo(map);

相关文章

网友评论

      本文标题:vue + SuperMap iClient(Leaflet)

      本文链接:https://www.haomeiwen.com/subject/buvukltx.html