I'm trying to create custom markers, but add 2 map layers.
Essentially trying to combine this: https://www.mapbox.com/mapbox-gl-js/example/custom-marker-icons/
With this: https://www.mapbox.com/mapbox-gl-js/example/toggle-layers/
How do I specify my customized markers, but assign them to 2 layers?
Markers don't exist within the map's Style, so they don't live within Layers either. They sit on top of the map, effectively within a single "layer" (but not actually a Layer).
So if you're trying to find a way to hide or show groups of markers in a single action, you'll have to find another way to do that.
Alternatively, if you really want your markers within Layers, you should create Symbol Layers with icons, not markers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With