ST_Aggr_Intersection

NoteNote:

ST_Geometry in Oracle only

Definition

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

Syntax

st_aggr_intersection (g1 sde.st_geometry)

Return type

ST_Geometry

Example

In this example, a biologist is trying to find the intersection of three wildlife habitats.

First, create the table that stores the habitats.

CREATE TABLE habitats (id integer, shape sde.st_geometry);

Next, insert the three polygons to the table.

INSERT INTO habitats VALUES (
1,
sde.st_polygon ('polygon ((5 5, 12 5, 12 10, 5 10, 5 5))', 0)
);

INSERT INTO habitats VALUES (
2,
sde.st_polygon ('polygon ((10 8, 14 8, 14 15, 10 15, 10 8))', 0)
);

INSERT INTO habitats VALUES (
3,
sde.st_polygon ('polygon ((6 8, 20 8, 20 20, 6 20, 6 8))', 0)
);

Finally, select for the intersection of the habitats.

SELECT sde.st_astext(sde.st_aggr_intersection(shape)) AGGR_SHAPES FROM habitats;

AGGR_SHAPES

POLYGON  (( 10.00000000 8.00000000, 12.00000000 8.00000000, 12.00000000 10.00000000, 
10.00000000 10.00000000, 10.00000000 8.00000000))

2/5/2013