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
发布的文章
JSON简介
2024-09-30 23:09:25
将文本文件转换为 JSON 格式的 Python 函数(兼容多行题目,多个选项卡以及无序号选项卡)
2024-09-30 23:09:25
40.Python从入门到精通—Python3 JSON 数据解析 Python3 日期和时间 什么是时间元组? 获取当前时间 获取格式化的时间
2024-09-30 23:09:20
推荐开源项目:JSON Formatter —— 美观易用的JSON渲染工具
2024-09-30 23:09:19
Fastjson各版本修补代码分析及绕过
2024-09-30 23:09:38
JSON 数据格式介绍及其应用
2024-09-30 23:09:38
npm 使用(创建,上传,删除)(1)
2024-09-30 23:09:12
Node.js 学习 path模块、fs模块、npm软件包管理器、导出、导入
2024-09-30 23:09:37
Node.js和npm的安装及配置
2024-09-30 23:09:02
大家推荐的文章