Your Location is: Home > Mapbox-gl-js

How do I add standard markers to Mapbox using addLayer()

From: Switzerland View: 3695 Seph Reed 

Question

If you simply add a marker, you get a standard marker:

https://docs.mapbox.com/mapbox-gl-js/example/add-a-marker/

If you use addLayer() there appears to be no description anywhere about how to use these standard markers:

https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/

map.addLayer({
    'id': 'POIs',
    'type': 'symbol',
    'source': 'POIs',
    'layout': {
        'icon-image': 'marker-15',  // this is a custom image... I just want a default, normal marker
        'icon-allow-overlap': true
    }
});

It's really easy to add special symbols, but I just want default markers. How do I do this with addLayer()

Best answer

Hugely disappointing news. Somehow it's just not possible:

https://github.com/mapbox/mapbox-gl-js/issues/656

I guess you just have to iterate over whatever your data is and use addMarker() for each.