Book Image

PostGIS Cookbook

Book Image

PostGIS Cookbook

Overview of this book

Table of Contents (18 chapters)
PostGIS Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Simplifying geometries with PostGIS topology


In a previous recipe, we used the ST_SimplifyPreserveTopology function to try to generate a simplification of a polygonal PostGIS layer.

Unfortunately, while that function works well for linear layers, it produces topological anomalies (overlapping and holes) in shared polygon borders. You used an external toolset (GRASS) to generate a valid topological simplification.

In this recipe, you will use the PostGIS topology support to perform the same task within the spatial database without needing to export the dataset to a different toolset.

Getting ready

To get started, follow the ensuing steps:

  1. Be sure that you have the PostGIS topology support enabled in your database instance. This support is packaged as a separate extension and, if you are using PostgreSQL 9.1 or newer versions, you can install it using the following SQL CREATE EXTENSION command:

    postgis_cookbook=# CREATE EXTENSION postgis_topology;
    
  2. Download the administrative area archive for Hungary...