Returns a set of geometry_dump records from a geometry object, expanding collections into their individual components.
Syntax
geometry_dump[] ST_Dump(geometry g1);Parameters
| Parameter | Description |
|---|---|
g1 | The geometry object that you want to specify. |
Description
ST_Dump extracts the components of a geometry object. Each returned geometry_dump record contains two fields:
geom: the component geometry objectpath: an integer array indicating the position of the component within the original geometry
Behavior varies by input type:
Point, LineString, or polygon input — Returns a single record with an empty
patharray and the input geometry asgeom.Multi-geometry or collection input — Returns one record per component, with a
patharray indicating each component's position within the collection.
ST_Dump is the inverse of GROUP BY: where GROUP BY aggregates rows into a single geometry, ST_Dump expands a single geometry into multiple rows. A typical use case is expanding a MultiPolygon into individual polygons.
The function supports the following geometry types: Circular String, curve, Polyhedral Surface, Triangle, triangulated irregular network (TIN) surfaces, and 3D objects.
Examples
The following example expands a MULTILINESTRING into its component LINESTRING geometries. The path column shows the position of each component.
SELECT (t.dump).path, ST_AsText((t.dump).geom)
FROM (
SELECT ST_Dump('MULTILINESTRING((0 0,0 2),(0 1,0 3))'::geometry) AS dump
) AS t;Output:
path | st_astext
------+---------------------
{1} | LINESTRING(0 0,0 2)
{2} | LINESTRING(0 1,0 3)
(2 rows)