[Qgis-user] geoalgorithm "Union"

Keith Jenkins kgjenkins at gmail.com
Wed Jan 8 12:53:25 PST 2025


Hi, Antonio.

Despite their names, the QGIS "Union" geoprocessing tool has a
completely different behavior than the PostGIS "ST_Union" function.

There is another QGIS tool called "Dissolve" which, when run without
selecting an optional dissolve field, should have similar output to
the ST_Union function.

Keith


On Wed, Jan 8, 2025 at 1:30 PM Antonio Valanzano via QGIS-User
<qgis-user at lists.osgeo.org> wrote:
>
> Does someone know if this algorithm is based on GEOS?
> I am asking this because its behaviour is different from that of ST_Union in PostGIS or Spatialite (both based I assume on the GEOS library).
>
> From QGIS help
>
> "This algorithm checks overlaps between features within the Input layer and creates separate features for overlapping and non-overlapping parts.
>
> The area of overlap will create as many identical overlapping features as there are features that participate in that overlap."
>
>
> From PostGIS help "Aggregate variant: returns a geometry that is the union of a rowset of geometries. The ST_Union() function is an "aggregate" function in the terminology of PostgreSQL.
>
> That means that it operates on rows of data, in the same way the SUM() and AVG() functions do and like most aggregates, it also ignores NULL geometries."
>
>
> As Martin Davis wrote on the PostGIS user list following my message
>
> "The behaviour of ST_Union with polygons follows the mathematical concept
> > of union in point-set topology.  It produces as few polygons as possible
> > which contain all the points of the input polygons...."
>
> ------------------------------------------------------------------------
>
> Based on my little test the difference is that:
>
> QGIS algorithm removes the overlapping parts creating separate polygons with the original attributes
>
> ST_Union does not remove any overlapping part (and a multistep procedure is required to obtain the same results)
>
> Regards
> Antonio


More information about the QGIS-User mailing list