// leaflet地图中添加区县边界
drawBoundary() {
const features = {}, // geoJson数据
const style = {
color: "#1492ff", // 边框颜色
weight: 2, // 边框粗细
opacity: 0.4, // 透明度
fillColor: "transparent", // 区域填充颜色
fillOpacity: 0, // 区域填充颜色的透明
dashArray: "dashed",
};
L.geoJSON(features, { style: style }).addTo(this.map); //features是指geojson数据
},
// features 可以写在js中,require导入,如
// BeiJing.min.js
export default {......}
// vue页面中
features: require("/public/libs/geojson/BeiJing.min.js").default,
// 最后在initMap() (mounted) 中使用这个方法即可
leaflet在地图上绘制省份、区县边界
于 2023-02-21 15:14:42 首次发布