当前位置:首页 > Web开发 > 正文

然后导入下面网站生成geojson

2024-03-31 Web开发

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 });

将舆图的视野范畴添加到相应区域。

leaflet 加载geojson叠加显示

标签:

原文地点:https://www.cnblogs.com/tiandi/p/12321413.html

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/30030.html