A set-returning function (SRF) that decomposes a geometry into its constituent components and returns a set of geometry_dump rows.
Syntax
geometry_dump[] ST_Dump(geometry g1);Parameters
| Parameter | Description |
|---|---|
g1 | The input geometry to decompose. |
Description
ST_Dump extracts the components of a geometry and returns one geometry_dump row per component. Each row contains two fields:
geom— the component geometrypath— an integer array indicating the position of the component within the input geometry
The behavior depends on the geometry type of the input:
Point, LineString, or Polygon — returns a single row with an empty
patharray and the original geometry asgeom.Multi* geometry or GeometryCollection — returns one row per component, with
pathindicating each component's position in the collection.
ST_Dump is the inverse of GROUP BY: where that operation combines rows into a single geometry, ST_Dump expands a single geometry into multiple rows. A common use case is expanding a MultiPolygon into individual Polygon geometries.
Supported geometry types:
Circular strings and curves
Polyhedral surfaces
Triangles and triangulated irregular network (TIN) surfaces
3D geometries
Examples
Expand a MultiLineString into component line strings
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)