Professional Documents
Culture Documents
1 Manual
240 / 315
Description
Returns a geometry that represents the portions of A and B that do not intersect. It is called a symmetric difference because
ST_SymDifference(A,B) = ST_SymDifference(B,A). One can think of this as ST_Union(geomA,geomB) - ST_Intersection(A,B).
Performed by the GEOS module
Note
Do not call with a GeometryCollection as an argument
This method implements the OpenGIS Simple Features Implementation Specification for SQL 1.1. s2.1.1.3
This method implements the SQL/MM specification. SQL-MM 3: 5.1.21
This function supports 3d and will not drop the z-index. However it seems to only consider x y when doing the difference
and tacks back on the Z-Index
Examples
See Also
ST_Difference, ST_Intersection, ST_Union
7.9.19 ST_Union
Name
ST_Union Returns a geometry that represents the point set union of the Geometries.
Synopsis
geometry ST_Union(geometry set g1field);
geometry ST_Union(geometry g1, geometry g2);
geometry ST_Union(geometry[] g1_array);
Description
Output type can be a MULTI* , single geometry, or Geometry Collection. Comes in 2 variants. Variant 1 unions 2 geometries
resulting in a new geomety with no intersecting regions. Variant 2 is an aggregate function that takes a set of geometries and
unions them into a single ST_Geometry resulting in no intersecting regions.
Aggregate version: This function returns a MULTI geometry or NON-MULTI geometry from a set 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.
Non-Aggregate version: This function returns a geometry being a union of two input geometries. Output type can be a MULTI*
,NON-MULTI or GEOMETRYCOLLECTION.
Note
ST_Collect and ST_Union are often interchangeable. ST_Union is in general orders of magnitude slower than
ST_Collect because it tries to dissolve boundaries and reorder geometries to ensure that a constructed Multi* doesnt
have intersecting regions.
Availability: 1.4.0 - ST_Union was enhanced. ST_Union(geomarray) was introduced and also faster aggregate collection in PostgreSQL. If you are using GEOS 3.1.0+ ST_Union will use the faster Cascaded Union algorithm described in http://blog.cleverelephant.ca/
2009/01/must-faster-unions-in-postgis-14.html
This method implements the OpenGIS Simple Features Implementation Specification for SQL 1.1. s2.1.1.3