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

233
Visualizações
leaflet.js:5 Uncaught TypeError: Cannot read properties of undefined (reading 'trim')

I've created a map with Leaflet and jQuery and I wanted to add Clustergroups to my Markers but I am getting the error : leaflet.js:5 Uncaught TypeError: Cannot read properties of undefined (reading 'trim')

Here my code:

  $.get(url).done(function (data) {


            var markers = L.markerClusterGroup();
            for (let i = 0; i < data.length; i++) {
                var title = "hi";

                let marker = L.marker(([data[i].latitude, data[i].longitude]));
                marker.bindPopup(title);
                markers.addLayer(marker);
               
            }
            mymap.addLayer(markers);

        }

I tried to search for the problem and found this https://github.com/Leaflet/Leaflet.markercluster/issues/724 but the problem was never answered. Also i read about different types of problems that it is maybe the problem of jQuery that it cannot define the variables. But I dont't know where my mistake could be, can anyone see it? Thanks in advance

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

0

You are useing twice () in marker creation.

Change:

let marker = L.marker(([data[i].latitude, data[i].longitude]));

to:

let marker = L.marker([data[i].latitude, data[i].longitude]);
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