Topology-preserving polygon simplification using the weighted Visvalingam-Whyatt algorithm. Reduces vertex count while guaranteeing no slivers, gaps, or overlaps between adjacent polygons.
- Topology-preserving — shared borders between adjacent polygons are simplified exactly once, so both neighbours always receive the same simplified edge. No slivers, no gaps.
- Weighted Visvalingam-Whyatt algorithm — the same algorithm used by MapShaper. Triangle areas are weighted by the angle at the centre vertex, so nearly-collinear points are removed first while geometrically significant vertices are protected.
- Geometry validity check — the input layer is checked for invalid geometries before processing. Invalid features are rejected with a clear error message.
- Optional geometry repair — if the output contains invalid geometries, the built-in QGIS Fix Geometries tool is applied automatically and the repaired layer is added to the project alongside the generalized one.
- Background processing — runs as a QGIS background task so the interface stays responsive. A progress bar tracks the three internal phases (topology build, simplification, reconstruction) and the task can be cancelled at any time.
- Download the latest
generalize-<version>.zipfrom the Releases page - In QGIS: Plugins → Manage and Install Plugins → Install from ZIP
- Select the downloaded zip and click Install Plugin
- Clone this repository into your QGIS plugin folder:
cd %APPDATA%\QGIS\QGIS3\profiles\default\python\plugins git clone https://github.com/peppo/generalize.git - Restart QGIS and enable the plugin in the Plugin Manager
- Load a polygon layer in QGIS
- Go to Vector → Generalize Polygons…
- Select the layer and set the reduction percentage (0–100 %)
- Optionally check Repair geometry if necessary
- Click OK — the generalized layer is added to the project when done
The generalization function can also be called from the QGIS Python console or another plugin:
from generalize.api import generalize_polygon_layer
layer = iface.activeLayer() # or any polygon vector layer
generalized_layer, orig_count, new_count = generalize_polygon_layer(layer, 50)Run the integration tests (requires QGIS 3.40 installed at the default path):
"C:\Program Files\QGIS 3.40.15\apps\Python312\python.exe" generalize/tests/test_topology.py
Test data is not included in this repository due to file size. Download one of the following and place it at generalize/test_data/verwaltungsgrenzen_vermessung/VerwaltungsEinheit.shp:
- Verwaltungsgebiete 1:25 000 (BKG, Germany-wide): https://gdz.bkg.bund.de/index.php/default/digitale-geodaten/verwaltungsgebiete/verwaltungsgebiete-1-25-000-stand-31-12-vg25.html
- Verwaltung Bayern OpenData (Bavaria only): https://geodaten.bayern.de/opengeodata/OpenDataDetail.html?pn=verwaltung
Bug reports and pull requests are welcome on the issue tracker.