import axios from 'axios';
import L from 'leaflet'
import 'leaflet/dist/leaflet.css'
const getGeoJson = (val) => {
const style = {
color: '#00F5FF',
weight: 5,
opacity: 1,
fillColor: 'red',
fillOpacity: 0
}
axios.get(`https://geo.datav.aliyun.com/areas_v3/bound/geojson?code=${val}`)
.then((ret) => {
const layer = L.geoJSON(ret.data.features, {
style
}).addTo(map)
map.fitBounds(layer.getBounds())
})
}
getGeoJson(cityId)
leaflet之加载区域矢量边界
最新推荐文章于 2024-06-14 11:01:38 发布