Generalizing a vector layer

Generalizing geometry, also known as simplifying, removes points from a vector layer to reduce the space required to store the data. Otherwise, simplification may result in small but acceptable changes within a specified tolerance.

Getting ready

For this recipe, we will use a boundary file for the state of Mississippi, which you can download from the following URL:

https://github.com/GeospatialPython/Learn/raw/master/Mississippi.zip

Extract the zipped shapefile to a directory named /qgis_data/ms.

How to do it...

Generalizing is native to QGIS, but we will access it in PyQGIS through the Processing Toolbox using the qgis:simplifygeometries algorithm.

  1. Start QGIS.
  2. From the Plugins menu, select Python Console.
  3. Import the processing ...

Get QGIS Python Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.