【发布时间】:2019-08-25 20:01:13
【问题描述】:
我已经定义了一个 mapbox geojson 来源:
map.addSource("places", {
type: "geojson",
data: "http://example.com/myfile.geojson",
});
我的 geojson 源文件有这样的结构:
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": {
"icon": "theatre"
},
"geometry": {
"type": "Point",
"coordinates": [-77.038659, 38.931567]
}},
{
"type": "Feature",
"properties": {
"icon": "music"
},
"geometry": {
"type": "Point",
"coordinates": [-77.020945, 38.878241]
}},
...]
}
我想获得“图标”属性的唯一名称(这里:剧院和音乐)。我如何遍历源以获得这些唯一值?此处的目标是从这些唯一名称中添加一个图层以进行过滤。
【问题讨论】:
标签: javascript mapbox mapbox-gl-js