Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
Leaflet LayerGroup - Mapbox GL JS Equivalent

Does anybody know of an equivalent to the Leaflet L.layerGroup in Mapbox GL JS? I can do this in leaflet:

var layerGroup = L.layerGroup().addTo(map);

And then if I want to add, say, a marker to the layer group, I can do

L.marker([50.5, 30.5]).addTo(layerGroup);

The functionality I am really trying to get is the ability to remove and add back these layers. In leaflet you can do

// remove the layer from the map
map.removeLayer(layerGroup)

// re-add the layer to the map
layerGroup.addTo(map)

// clear all layers without removing from the map
layerGroup.clearLayers()

However in Mapbox GL JS I haven't found a functionality or a plugin that does something similar to this. When you want to add something to the map in Mapbox, you can do .addTo(map), so it seems to me there is probably a feature where you can create a layer group and do .addTo(layerGroup).

It might not be exactly how I envision it here, but right now I have nothing.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda