Categories:

Geospatial Functions

ST_INTERSECTION_AGG

Given a GEOGRAPHY column, returns a GEOGRAPHY object that represents the shape containing the combined set of points that are common to the shapes represented by the objects in the column (that is, the intersection of the shapes).

See also:

ST_INTERSECTION , ST_UNION_AGG

Syntax

ST_INTERSECTION_AGG( <geography_column> )
Copy

Arguments

geography_column

A GEOGRAPHY column.

Returns

The function returns a value of type GEOGRAPHY.

Examples

The following example uses a table that contains GEOGRAPHY objects that represent counties in different states. For each state, the example returns the shape that consists of the intersection of the areas of the counties in that state.

SELECT state_name,
  ST_INTERSECTION_AGG(county) as intersection_of_counties
  FROM counties_by_state
  GROUP BY state_name;
Copy