Code-for-All / geodata-scripts

Various scripts for processing geodata
1 stars 0 forks source link

Upload .geojson file to mapbox.com #3

Closed Mike-Honey closed 5 years ago

Mike-Honey commented 5 years ago

For the Mapbox visual, I need to upload a .geojson file to Mapbox to replace an existing Tileset. Is it possible to integrate that into the python script?

milovanderlinden commented 5 years ago

According to the instructions here: https://docs.mapbox.com/help/tutorials/upload-curl/ we should be able to integrate that step using curl. I will experiment if this can be done.

milovanderlinden commented 5 years ago

I have this working for the raw geojson files (without minification). I will close this issue as it is technically done although we should look out not to upload all the datasets or we will be looking at a rather pricy mapbox plan :-)

Mike-Honey commented 5 years ago

I tried this out but struck an error:

C:\Dev\INPE\geodata-scripts\python>python shapetogeojson.py deter_all.shp-201909 Traceback (most recent call last): File "shapetogeojson.py", line 176, in main() File "shapetogeojson.py", line 172, in main uploadToMapbox(datadir) File "shapetogeojson.py", line 34, in uploadToMapbox mapboxUpload(os.path.join(datadir, file), os.path.splitext(file)[0]) TypeError: mapboxUpload() takes 1 positional argument but 2 were given

In main, I commented out the calls to getunzipped and shape2geojson. The only geojson file in my data directory is: deter_all.shp-201909.geojson. I've made a shapetogeojson.env file in my C:\Dev\INPE\geodata-scripts\python folder, following your notes. I pip installed mapbox and python-dotenv. Let me know if you need any further info.

Mike-Honey commented 5 years ago

My mapbox user id is: mike-honey

I wonder if the hyphen is triggering that issue ? Perhaps I should quote or escape it?