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

422
Vistas
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 Respuestas
Responde la pregunta

0

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

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