使用esri-leaflet
先放官网网址:
L.esri.DynamicMapLayer | Esri Leaflet | ArcGIS Developers
npm下载:
npm install leaflet --save
导入:
import dynamicMapLayer from 'esri-leaflet/src/Layers/DynamicMapLayer'
或者 CDN:
<script
src="https://unpkg.com/esri-leaflet@3.0.10/dist/esri-leaflet.js"
integrity="sha512-i9mZ/0lnBMdKZjkVQXImtZbWzrhomyyQzXarfT4ki1eD/Bi+rcV4lFyzX52lbRQtqj070JQea4p8QNCMrHzuYg=="
crossorigin=""></script>
加入arcgis服务图层:
var addLayer_data = L.esri.dynamicMapLayer({
url: dataList.arcgisUrl,
opacity: 0.8,
f: "json",
// layers: [5,6,8,10,18,3],
})
查找图层信息:利用相关api
代码:
addLayer_data.identify().at(latlng).on(map)
.run(function(error,res) {
})