Skip to content

A simple Flask/leaflet based webapp for rendering vector tiles from PostGIS

License

Notifications You must be signed in to change notification settings

mblackgeo/flask-vector-tiles

Repository files navigation

Flask Vector Tiles

A simple Flask and LeafletJS based webapp for rendering vector tiles from PostGIS using pg_tileserv.

Example

This project was made thanks to the excellent Docker and Leaflet examples provided in the pg_tileserv documentation.

Prerequisites

Usage

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

Development

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

About

A simple Flask/leaflet based webapp for rendering vector tiles from PostGIS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published