Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

141
Visualizações
How to add point_count divieded by some value to map

Using Mapbox GL JS I want to add to the map the number of markers in a cluster divied by 10.

I can add the point_count and point_count_abbreviated attributes as following:

map.addSource("uploaded-source", {
            type: "geojson",
            data: geoJSONcontent,
            cluster: true,
            clusterMaxZoom: 15, 
            clusterRadius: 50, 
          });

map.addLayer({
            id: "cluster-count",
            type: "symbol",
            source: "uploaded-source",
            filter: ["has", "point_count"],
            layout: {
              "text-field": "{point_count_abbreviated}",
              "text-font": ["DIN Offc Pro Medium", "Arial Unicode MS Bold"],
              "text-size": 12,
            },
          });

How do I add point_count_abbreviated divided by some number to the map?

Unfortunately my JS knowledge is not that advanced, I tried things like:

 "text-field"://{point_count_abbreviated}/10
              //String(Number("{point_count_abbreviated}")/10),
              //"{point_count_abbreviated}".slice(0, -1),
              //String(Number(['/', ["get", Number("{point_count_abbreviated}")], Number(10)]))
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You need a Mapbox GL expression.

"text-field": ["/", ["get", "point_count"], 10]

I'm not sure if it needs to be converted to a string. If so:

"text-field": ["to-string", ["/", ["get", "point_count"], 10]]
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda