Book Image

QGIS Python Programming Cookbook

Book Image

QGIS Python Programming Cookbook

Overview of this book

Table of Contents (16 chapters)
QGIS Python Programming Cookbook
About the Author
About the Reviewers

Generalizing a vector layer

Generalizing the geometry, also known as simplifying, removes points from a vector layer to reduce the space required to store the data on disk, the bandwidth needed to move it over a network, and the processing power required to perform analysis with it or display it in QGIS. In many cases, the geometry of a layer contains redundant points along with straight lines that can be removed without changing the spatial properties of a layer, with the exception of topology constraints.

Getting ready

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

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, as follows:

  1. Start QGIS.

  2. From the Plugins menu, select Python Console.

  3. Import the processing module...