Returns a multipolygon containing all of the polygons in a group.
ST_MultiPolygon::ST_MultiPolygonAggr(geometry-column[ ORDER BY order-by-expression [ ASC | DESC ], ... ] )
Name | Type | Description |
---|---|---|
geometry-column |
ST_Polygon |
The geometry values to generate the collection. Typically this is a column. |
ST_MultiPolygon Returns a multipolygon that contains all of the geometries in a group.
The spatial reference system identifier of the result is the same as that for the first parameter.
The ST_MultiPolygonAggr aggregate function can be used to combine a group of polygons into a single collection. All of the geometries to be combined must have both the same SRID and the same coordinate dimension.
Rows where the argument is NULL are not included.
Returns NULL for an empty group or a group containing no non-NULL values.
The resulting ST_MultiPolygon has the same coordinate dimension as each polygons.
The optional ORDER BY clause can be used to arrange the elements in a particular order so that ST_GeometryN returns them in the desired order. If this ordering is not relevant, it is more efficient to not specify an ordering. In that case, the ordering of elements depends on the access plan selected by the query optimizer.
ST_MultiPolygonAggr is more efficient than ST_UnionAggr, but ST_MultiPolygonAggr can return a collection with duplicate or overlapping polygons if they exist in the group of polygons. In particular, returned collections containing overlapping surfaces may case unexpected results if they are used as input to other spatial methods. ST_UnionAggr handles duplicate and overlapping geometries.
By default, ST_MultiPolygonAggr uses the original format for a geometry, if it is available. Otherwise, the internal format is used. For more information about internal and original formats, see STORAGE FORMAT clause, CREATE SPATIAL REFERENCE SYSTEM statement.
SQL/MM (ISO/IEC 13249-3: 2006) Vendor extension
The following example returns a single value which combines all geometries of type ST_Polygon from the SpatialShapes table into a single collection of type ST_MultiPolygon. If the Shape column was of type ST_Polygon then the TREAT function and WHERE clause would not be necessary.
SELECT ST_MultiPolygon::ST_MultiPolygonAggr( TREAT( Shape AS ST_Polygon ) ) FROM SpatialShapes WHERE Shape IS OF( ST_Polygon ) |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |