Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapbox how to hide some points of interest

I have a mapbox showing a layer from a dataset of mine. But in my map also some other points of interest are shown, for example a bar, a gas station, etc that I would like not to be there. How can I hide those unwanted POI ?

I am using mapbox js with ionic3.

This is my relevant initialization code:

    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,
            },

        });

In the above code, questo.places contains my own personal POI (the only ones i would like to appear in the map)

Thanks very much in advance

like image 658
Demy Mortelliti Avatar asked Sep 16 '25 06:09

Demy Mortelliti


1 Answers

If those POI are not coming from your dataset, they are probably from your map style.

Take a look at that map from the Mapbox Studio. On the left sidebar there should be several label layers. Try to hide/delete those that you don't need.

like image 59
MeltedPenguin Avatar answered Sep 19 '25 16:09

MeltedPenguin