Querying Postgres with Python Fastapi Backend and Leaflet-Geoman Frontend - Applying Geometry Filters

Geometry Filter Popup

Querying Postgres with Python Fastapi Backend and Leaflet & Geoman Fronted - Applying Geometry Filters

How to query a database with a user-defined geometry drawn on a Leaflet frontend?

A very common use case for map applications are custom filters. Either thematic, temporal or value-based filters play a significant role but probably in a geographical context the most dominant one might be spatial filtering. In this blog post, I describe a simple boilerplate setup based on postgres, fastapi and geoman.

Hugo blog routine - write, preview, edit, commit

1
2
3
4
5
6
7
8

 ██████╗ ███████╗ ██████╗    ██████╗  ██████╗  ██████╗██╗  ██╗███████╗
██╔════╝ ██╔════╝██╔═══██╗   ██╔══██╗██╔═══██╗██╔════╝██║ ██╔╝██╔════╝
██║  ███╗█████╗  ██║   ██║   ██████╔╝██║   ██║██║     █████╔╝ ███████╗
██║   ██║██╔══╝  ██║   ██║   ██╔══██╗██║   ██║██║     ██╔═██╗ ╚════██║
╚██████╔╝███████╗╚██████╔╝██╗██║  ██║╚██████╔╝╚██████╗██║  ██╗███████║
 ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝╚═╝  ╚═╝ ╚═════╝  ╚═════╝╚═╝  ╚═╝╚══════╝
                                                                      

My simple blog routine: how to create a post, preview and commit to production.