Using Python for basic GIS: Folium, Flask, Heroku, and open data APIs
Interactive notebooks that go into depth, with links, comments, and examples including GeoJSON/choropleths and the Walk Score API. You can click the badge to play around with the code on Google Colaboratory, but without API keys some of the live data functionality won't work.
You can also view static versions on nbviewer:
A barebones Flask app that demonstrates some basic Folium functionality using the WMATA API. This exact repository is hosted on Heroku here. It takes one of the demo examples and shows how it can be delivered through a web browser. The code is meant to showcase possibilities, not best practices. Don't judge me.
The project was developed under Python 2.7 updated to Python 3.7!
requirements.txt
WMATA_KEY
environment variable set to your WMATA API keyenvironment.yml
demo/secrets/.wmata
and demo/secrets/.walkscore
You can get a temporary guest API key for WMATA.
The higher level technologies used are:
See the Jupyter notebook for links to documentation relevant to the demos, including Flask, Folium, and links to the APIs used.
Option A (Suggested): Use the Python buildpack and deploy with Git.
Option B: If you end up needing a lot of packages or want to use Conda, you can try deploying with Docker.
heroku login
.heroku create <app_name> --buildpack heroku/python
or leave the name blank to auto-generate one.requirements.txt
file with all dependencies for the app.runtime.txt
file that specifies the Python runtime version, eg. python-3.7.1
.Procfile
that has eg. web: gunicorn --pythonpath . tracker --log-file=-
.git push heroku master
. You should be able to access your app at https://<app_name>.herokuapp.com
.There is a quickstart guide available as a reference.
heroku logs
can display remote logs from your app, however heroku local
will run the app at localhost:5000
and will be more useful for debugging.