Generalization
Cartographic generalization is the process turning detailed geographic data into more general data for smaller zoom levels or smaller scale maps. It is essential for generating good-looking, easy to interpret, and fast rendering small scale maps.
Currently osm2pgsql has almost no built-in support for generalization, usually it is done using lots of SQL magic after the initial import of the data with osm2pgsql. From September 2022 to February 2023 we ran a project funded by the Prototype Fund and the German Federal Ministry of Education and Research to add more support for generalization to osm2pgsql. This included adding some generalization support directly to osm2pgsql but also using the capabilities of the PostgreSQL database and especially the PostGIS extension in a more easy to use fashion.
Here are the posts from Jochen’s blog describing the progress of the project:
- Generalization of OSM data
- Selection of generalization problems
- Finding representative points for polygons
- Processing architecture for generalization in osm2pgsql
- Generalizing polygons
- PostgreSQL raster experiments
- Selecting settlements to display
- Deriving built-up areas
- Generalizing river networks
- Tile expiry and generalization
- Generalization project wrapup
And here are the most important related pull requests (already merged):
In addition a lot of code has been added in many small PRs to add and extend some (basic) functionality needed for this project.
The code is now merged into osm2pgsql master branch but still marked as experimental. See the preliminary documentation for all the details.
Jochen gave a talk (in German) about this project at FOSSGIS 2023: slides, video download