function setLightSpot() { // 获取两种点位数据 homepageQuery({ type: 1, }).then((res: AnyObject) => { if (res.code == 200) { homepageQuery({ type: 2, }).then((ret: AnyObject) => { if (ret.code == 200) { let features = []; for (let item of res.data) { let wkt = parse(item); let feature = { type: 'Feature', properties: { color: '#FFD86F', }, geometry: wkt, }; features.push(feature); } for (let item of ret.data) { let wkt = parse(item); let feature = { type: 'Feature', properties: { color: '#cc7bff', }, geometry: wkt, }; features.push(feature); } addLuminousSpot(map, features); } else { Message.success(ret.msg); } }); } else { Message.success(res.msg); } }); } // 添加点位图层 function addLuminousSpot(map: any, features: AnyObject[]) { if (map.getLayer('park-volcanoes')) { map.removeLayer('park-volcanoes'); map.removeSource('park-volcanoes'); } map.addLayer({ id: 'park-volcanoes', type: 'circle', source: { type: 'geojson', data: { type: 'FeatureCollection', features, }, }, paint: { 'circle-radius': 2, 'circle-color': ['get', 'color'], 'circle-opacity': 0.8, }, }); } // 删除点位图层 function luminousSpotShow(map: any) { if (map.getLayer('park-volcanoes')) { map.removeLayer('park-volcanoes'); map.removeSource('park-volcanoes'); } }
复制
地图添加发光点效果
转载请注明出处或者链接地址:https://www.qianduange.cn//article/18845.html
发布的文章
C#解析JSON的常用库--Newtonsoft.Json
2024-11-30 11:11:42
jsonfield 项目常见问题解决方案
2024-11-30 11:11:42
【SpringMVC】_SpringMVC项目返回HTML与JSON
2024-11-30 11:11:41
BugJson因为json格式问题OOM怎么办
2024-11-30 11:11:41
python 解读JSON文件,一文搞懂!
2024-11-30 11:11:40
Redisson同时使用jackson、fastjson、kryo、protostuff序列化(含效率对比)
2024-11-30 11:11:40
开源项目“Pretty JSON”安装与配置完全指南
2024-11-30 11:11:39
2024年前端最新Nodejs基础之包管理工具npm(二)(2),微软面试题及答案
2024-11-30 11:11:39
解决全局安装pnpm后无法使用的问题
2024-11-30 11:11:39
安装Nodejs后,npm无法使用
2024-11-30 11:11:38
大家推荐的文章