Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

416
Views
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 answers
Answer question

0

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

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!