FOSS4G 2022 general tracks

Geo-Infographics created dynamically from PostGIS using ST_AsSVG
2022-08-25, 10:05–10:10 (Europe/Rome), Room 9

The Problem

Let's assume you have an attribute-focused table, but you would still like to see a thumbnail of the associated geometry. Or more generally: How to dynamically render polygon geometries in a HTML page without any mapping library. Enter ST_AsSVG (PostGIS function)!

Context

Last year I showed how we display geo data in our webapps using vector tiles (ST_AsMVT). This year I will explain how we apply ST_AsSVG of PostGIS on database records to create beautiful geo-infographics in pure HTML. The result is a geo-visualization similar to this one: Comparison maps of Australian Cities (Size, Population). The trickiest part will be the sizing of the SVG objects (viewport vs. viewBox).

Content

The talk will contain some theory on SVG. It will then show basic setups for FastAPI, SQLModel, Jinja2 and, of course, PostGIS. All code will be made available via GitHub.

Aim

After the talk you will master sizing of SVG and be capable of creating your own dynamic geo-infographics directly from data stored in your PostGIS database.

Cartographer, Vector Data and Python GIS Specialist | Loved by Christ, blessed by the Father. Never satisfied with superficial answers. Youth ministry leader. Reading, cooking, (train) traveling, board games, jigsaw puzzles, pilgrimages.