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

128
Visualizações
Leaflet marker in polygon

I made a map with Leaflet.js with GeoJSON data and all it's right. But when i want put a marker in a Polygon i cant.

I leave a clipping of my code. Everything works except the marker

          data: squareParkData,
          color: "black",
          fillColor: "green",
          fillOpacity: 0.3,
          weight: 1,
          onEachFeature:onEachFeature,
          pointToLayer: function (feature, latlng) {
            return L.marker(latlng, { icon: municipalDependenceIcon });
          }
        }) ```

Thanks
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

According to the specifications, it seems like the pointToLayer is used for geomtery type 'points'.

Points are handled differently than polylines and polygons

You can use the (onEachFeature's) feature geometries and add a new marker to the layer.

To compute for the center of multiple points, you can use TurfJS https://turfjs.org/docs/#centroid

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