Using the example here I'm trying to add markers to a map using files and code from my local directory. In the directory I have airports.csv & index.html. I can't get the map to show the markers. This is the line of code i use to load the csv all other code is as the original example and copied into the index.html file ;
omnivore.csv('airports.csv'/assets/data/airports.csv').addTo(map);
I've tried copying in the full file path as well but this makes no difference to the outcome. I've also tried calling a url for the same file stored here. I'm new to html / javascript. Any help gratefully appreciated
If both your index.html
file and your airports.csv
file are located in the very same folder, then you should be able to load the CSV file using directly:
omnivore.csv('airports.csv').addTo(map);
Note that if the CSV file is very big, you will have to wait for a few seconds (up to minutes, depending on your bandwidth…) for the browser to fetch the file from the server.