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/[email protected]/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/>
<script src="https://unpkg.com/[email protected]/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?

2
  • See stackoverflow.com/q/10752055/4768502 Commented Jun 16, 2023 at 12:07
  • 1
    What do you mean by local? From file system? Any errors in the browser debugger console or network section? Please edit your question with additional info Commented Jun 16, 2023 at 12:29

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.