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

247
Visualizações
GeoJSON layer not showing up on leaflet map

I'm struggling with making my GeoJSON points to show up on leaflet map.

The codes for the javascript where I tried to add in the GeoJSON:

        var coniferous = L.layerGroup();

        var geojsondata = new L.GeoJSON.AJAX("treedata2.geojson", {
        pointToLayer: function(geoJsonPoint, latlng) {return L.marker(latlng);}}).addTo(coniferous);

I have already referenced the ajax plugin in the head section of the html file

    <script src="leaflet.ajax.js"></script>

The GeoJSON file code is as follow

{
"type": "FeatureCollection",
"name": "Significant Trees",
"features": [
{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-79.484593, 43.696533, 0.0]}, "properties": {"What_is_the_species_name": "Maple"}},
{"type": "Feature", "geometry": {"type": "Point", "coordinates": [-79.433099, 43.846487, 0.0]}, "properties": {"What_is_the_species_name": "Pine"}}
]
}

I have also tried to coordsToLatLng but it doesn't seem to be the problem as the markers don't still show up at all, not even in the wrong locations.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You need to add the LayerGroup to the map: var coniferous = L.layerGroup().addTo(map);

over 4 years ago · Santiago Trujillo 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