I have a polygon shapefile, which I need to generalize.

How can I generalize the polygons and ensure that there are no topological errors like slivers?

I have already tried:

  1. Vector -> Geometry Tools -> polygons to lines
  2. Vector -> Geometry Tools -> simplfy geometries ... here I can already see on the screen, that I am producing overlaps and gaps nevertheless now I try
  3. Vector -> Geometry Tools -> lines to polygons

and here the program shows an error and crashes

enter image description here


4 Answers 4


GRASS is topology-aware. You can use v.generalize from the Processing toolbox to simplify polygons and if the input data is topologically correct so will the output.

enter image description here


This can be seen as a preliminary to @Underdark's answer whereby you can clean the topology of the vector layer before generalizing. GRASS has a v.clean function which contains a number of tools to repair the layer such as:

  • snap which 'snaps' lines to the nearest vertex
  • rmdangle which removes any annoying dangles
  • rmdupl which removes duplicated geometry features

and various others shown in the image below:


You can also set the threshold depending on how sensitive you want the tools to run. Personally, I tend to use the Check Geometry Validity feature in QGIS (Vector > Geometry Tools > Check Geometry Validity) to check for any errors and if any exist, use the appropriate tool in v.clean. Once the errors are removed, you should be in a better position to generalize.


You could try using MapShaper.

I've found this to be a good way of generalizing polygons; there's also an offline version if you want to download the code.

An alternative could be convert this to GeoJson, and then TopoJson which supports "topology-preserving shape simplification" https://github.com/mbostock/topojson


I just did a quick test, and the "Simplify Geometries' tool under the Vector menu appears to respect the topology. I tried with and without the "Enable topological editing" checked off under Snapping Options.

This was done directly on the polygon file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.