1. 首先要在arcgis发布服务,把需要用的地图服务发布上去,url=http:服务器url~:6080/arcgis/rest/services/~文件夹
名/MapServer
2. 运用esri-leaflet中的方法调用arcgis,配置如下:
首先:去官网下载esri- leaflet.js 并引入到项目中,下载地址是(两种方法)
http://esri.github.io/esri-leaflet/download/;npm install esri-leaflet --save3.发布的服务有两种方式,一种是影像(tiledMapLayer),一种是 矢量 (dynamicMapLayer)
影像方法:
var map = L.map('map').setView([37.7614, -122.3911], 12); L.esri.tiledMapLayer({ url: 'https://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer', maxZoom: 15}).addTo(map);矢量方法:
var map = L.map('map').setView([37.7614, -122.3911], 12); L.esri.dynamicMapLayer({ url: "http://124.152.158.58:6080/arcgis/rest/services/ZYSDT/MapServer", // opacity: 0.5, transparent: true //layers: ["dynamic"] }).addTo(map);
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删