leaflet 加载geojson叠加显示
geojson需要先制作shp,然后导入下面网站生成geojson。
https://mapshaper.org/
geojson,最好放后台,前台通过异步请求去加载json,然后显示。
getGeojsonByName({name:geojson_name}).then(data=>{ if (this.bondarylayer) { if (this.map.hasLayer(this.bondarylayer)) { this.map.removeLayer(this.bondarylayer); } } this.bondarylayer = L.geoJSON(data, { style: { color: ‘#E066FF‘, fillOpacity: 0, weight: 4, }, pane: ‘overlayPane‘ }); this.map.addLayer(this.bondarylayer); });
叠加地图之后,
this.map.flyTo([34.22, 109.114], 9, { animate: true, duration: 0.2 });将地图的视野范围添加到相应区域。
相关推荐
sailxu00 2020-06-18
somebodyoneday 2020-06-06
newthon 2020-02-21
baijinswpu 2020-01-28
fengchao000 2019-10-31
cfh00 2019-07-01
fengchao000 2017-06-28
qianqianxiao 2019-06-29
mingyangwang 2018-12-27
cfh00 2019-06-27
yigeng 2014-09-05
lnn 2019-05-29
kkpiece 2019-03-15
yangguangdblu 2019-03-01
Pythonandme 2019-01-03
LHpython 2019-01-03