de
en

Aggregate Polygons

Often it is necessary to grasp for cartographic purposes unconnected polygons together and to generalize in this way. E.g. if groups are to be taken from individual buildings to a residential area together. With the PostGIS aggregation function aggregatepolygons() developed by Kappasys, this aggregation can be performed easily.

The aggregation function aggregatepolygons (geometry, double precision, boolean) expects three parameter

  1. the geometry column
  2. Threshold, within the polygons are taken together in map units
  3. Orthogonal aggregation of objects. True=orthogonal and False=non orthogonal. In Figure 1, the orthogonal aggregation has been performed. Figure 2 shows an example of non-orthogonal aggregation

Installation

In order to avoid not valid geometries during the aggregation process first the cleangeometry() function has to be installed (see Downloads). In the second step, install the aggregation function aggregatepolygons() .

 

$ psql <dbname> -U <user> -h <server> -f cleanGeometry.sql

$ psql <dbname> -U <user> -h <server> -f aggregatePolygons.sql

 

Downloads

cleanGeometry.sql

Geometry Cleaner Rev 1.0

2.4 K

aggregatePolygons.sql

Polygon Aggregation Rev. 1.0

3.0 K

Example 1: Orthogonal Aggregation of Buildings

Figure 1 shows the result of an orthogonal aggregation of buildings.

 

Query:

select aggregatepolygons(wkb_geometry, 50, true) from buildings group by art;

Figure 1: Orthogonal Aggregation of Buildings

Example 2: non Orthogonal Aggregation

The result of a non-orthogonal aggregation is shown in Figure 2. As a rule, natural objects such as e.g. Forest summarized in this way.

Query:

select aggregatepolygons(wkb_geometry, 50, false) from forest group by art;

 

Abbildung 2: Non Orthogonal Aggregation of Natural Objects