1

I have an issue with loading a local GeoJSON file into a simple Leaflet map.

I followed the answer from Loading external GeoJSON file into Leaflet map?:

I included the path to the leaflet.ajax.min.js as per the code below (in the head):

<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<script src="plugins/leaflet.ajax.min.js"></script> 

And then in the script I'm adding the layer:

var geojsonLayer = new L.GeoJSON.AJAX("CurrentPosition.geojson");       
geojsonLayer.addTo(map);

When I open the index.html file, the tiles load normally, but the GeoJSON file is not there. What am I doing wrong?

Vince
  • 20,017
  • 15
  • 45
  • 64
Pawel
  • 408
  • 4
  • 15

0 Answers0