0

I've used QGIS2WEB to output a leaflet map, all of which works well. It's a simple map showing markers, I want the markers to update based on a csv which is updated daily. Omnivore looks like my solution, so i've tried to edit the code QGIS2WEB gives me.

I can see that the CSV in QGIS is converted to a geojson file (i think) and stored in the data folder as;

csv_data.js

This is then called in the main html file using

<script src="data/csv_data.js"></script>.

I've tried editing the contents of the csv_data.js from;

var csv_data = {
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": 
"urn:ogc:def:crs:OGC:1.3:CRS84" } },

to

var csv_data = omnivore.csv(url) 

I'm using the mapbox omnivore library with a call to that in the main body of the html using;

<script src='https://api.mapbox.com/mapbox.js/plugins/leaflet-omnivore/v0.3.1/leaflet-omnivore.min.js'></script>

But this returns no markers, the folder structure is as QGIS2WEB output as screen grab.

enter image description here

In the console i get two errors;

Uncaught ReferenceError: omnivore is not defined & Uncaught ReferenceError: csv_data is not defined

I'm new to javascript and html so not sure whhat is causing either of these

  • Are you loading omnivore before using it? The execution order matters. – Tom Chadwin Feb 24 '18 at 23:30
  • I think so, i assume putting it at the start of the main html means it should call first? Or should i put it in the csv_data.js file before the var csv_data = omnivore.csv(url) ? – mapping dom Feb 25 '18 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.