我有一个显示我的数据集中的图层的映射框。但是在我的地图上还显示了其他一些我不希望出现的景点,例如酒吧,加油站等。如何隐藏那些不需要的POI?
我正在与ionic3一起使用mapbox js。
这是我相关的初始化代码:
var questo = this;
questo.map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/cjaudgl840gn32rnrepcb9b9g',
center: [11.381054062288769, 43.517016927850099],
zoom: 17.15,
pitch: 15,
});
questo.map.on('load', function () {
questo.map.addLayer({
"id": "points",
"type": "symbol",
"source": {
"type": "geojson",
"data": questo.places
},
"ssource": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-77.03238901390978, 38.913188059745586]
},
"properties": {
"title": "Mapbox DC",
"icon": "monument"
}
}, {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-122.414, 37.776]
},
"properties": {
"title": "Mapbox SF",
"icon": "harbor"
}
}]
}
},
"layout": {
"icon-image": "{icon}-15",
"text-field": "{title}",
"text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"],
"text-offset": [0, 0.6],
"text-anchor": "top",
"icon-size": 1.20,
},
});
在上面的代码中,questo.places包含我自己的个人POI(我唯一想在地图上显示的POI)
首先十分感谢
最佳答案
如果这些POI不是来自您的数据集,则可能来自您的地图样式。
在Mapbox Studio中查看该地图。在左侧边栏应该有几个标签层。尝试隐藏/删除不需要的内容。