Rendering vector tiles from Postgres/Postgis database

Dear all, I have a “classic” OpenStreetMap raster tile toolchain working (Postgres, PostGis, Mapnik, renderd, hourly updates). Now I would like to render vector tiles e.g. for MapLibre from the same Postgres database.

I know I could use prerendered tiles, e.g. mbtile files, with many vector tile servers. But then I would have to download these mbtiles files separately, which sounds like a lot of unnecessary traffic: I already have a OSM Postgres database that is always up to date, so I would love to use that for serving vector tiles as well.

So which tools do I use for vector tiles based on Postgres?

2 Likes

Short answer: PostGis is able to render vector tiles, the function is ST_AsMVT .

https://postgis.net/docs/ST_AsMVT.html

And there are various tileservers that automate much of this for you, such as GitHub - maplibre/martin: Blazing fast and lightweight PostGIS, MBtiles and PMtiles tile server, tile generation, and mbtiles tooling. .

1 Like