ST_Aggr_Union

HinweisHinweis:

ST_Geometry in Oracle only

Definition

ST_Aggr_Union returns a single ST_Geometry object that is the union of all input geometries.

Syntax

sde.st_aggr_union(g1 sde.st_geometry)

Return type

ST_Geometry

Example

A marketing analyst needs to create a single geometry of all the service areas for which sales exceeded 1,000 units.

CREATE TABLE service_territories 
(ID integer, UNITS number, SHAPE sde.st_geometry);

INSERT INTO service_territories VALUES (
1, 
1250,
sde.st_polygon ('polygon ((20 30, 30 30, 30 40, 20 40, 20 30))', 0)
);
 
INSERT INTO service_territories VALUES (
2, 
875,
sde.st_polygon ('polygon ((30 30, 30 50, 50 50, 50 30, 30 30))', 0)
);
 
INSERT INTO service_territories VALUES (
3, 
1700,
sde.st_polygon ('polygon ((40 40, 40 60, 60 60, 60 40, 40 40))', 0)
);

The SELECT statement returns the multipolygon that is the union of all shapes for which sales numbers were equal to or greater than 1,000 units.

SELECT sde.st_astext(sde.st_aggr_union(shape)) UNION_SHAPE
FROM service_territories WHERE units >= 1000;

UNION_SHAPE

MULTIPOLYGON  ((( 20.00000000 30.00000000, 30.00000000 30.00000000, 30.00000000
40.00000000, 20.00000000 40.00000000, 20.00000000 30.00000000)),(( 40.00000000 40.00000000, 
60.00000000 40.00000000, 60.00000000 60.00000000, 40.00000000 60.00000000, 
40.00000000 40.00000000)))

3/6/2012