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

187
Vistas
Highlight Mapbox cluster if it contains any feature of a given Array

I am using mapbox clustering to cluster a large set of features, this is the current layer object:

{ 
  id: 'markerclusters', 
  type: 'circle', 
  source: 'markers', 
  filter: ['has', 'point_count'], 
  paint: { 
    'circle-color': ['step', ['get', 'point_count'], '#d11507', 10, '#a51b0b', 20, '#7a1b0c'], 
    'circle-radius': ['step', ['get', 'point_count'], 20, 10, 30, 20, 40] }

The features on the map all have an id property and the user can search by keyword to highlight one or more features. That will give me an array of features and I would like to highlight the markers and the clusters that include them. It already works fine for the markers by setting the layout property to this:

'icon-color', ['case', ['in', ['get', 'id'], ['literal', highlightedFeatures]], '#AAFB23', '#000000']

But I'm unsure how to do this for the clusters. As far as I can tell there's no API to get the features of a cluster, so I thought about the possibility to create a custom cluster property containing the feature ids, but I haven't found any operator that could build an array in the layer expressions of mapbox. And not just that, there also doesn't seem to be any operator to check if two arrays intersect, so I'm unsure what to do here...

Any ideas are appreciated!

about 4 years ago · Santiago Gelvez
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