A simple Flask and LeafletJS based webapp for rendering vector tiles from PostGIS using pg_tileserv.
This project was made thanks to the excellent Docker and Leaflet examples provided in the pg_tileserv documentation.
- Install Docker and docker-compose
- Have
make
andwget
installed
The Makefile
includes helpful commands for running the backend and frontend services using docker compose.
To get started simply run the following commands:
make build # builds the docker images
make ingest # download and ingest the Natural Earth country boundaries into PostGIS
make run # run the full stack (PostGIS + pg_tileserv and Flask)
To view the map after running make run
(or make run-detached
), open http://localhost:8000 in your browser.
Additional commands can also be viewed by running make help
. Once finished, to clean up run:
make clean # optionally, when finished delete the containers and volumes
For local development, pre-commit should be installed and the application can be installed as editable along with the dev requirements:
pre-commit install
pip install -e .
pip install -r requirements-dev.txt
- Pytest is used for the functional tests of the application (see
/tests
). - Code is linted using flake8 with
--max-line-length=120
- Code formatting is validated using Black
- pre-commit is used to run these checks locally before files are pushed to git
- The Github Actions pipeline also runs these checks and tests