ST_DumpPoints

更新时间:
复制 MD 格式

Returns a set of geometry_dump rows for the input geometry. Each row contains a geom field holding a geometry and a path field holding an integer array that identifies the point's position within the input geometry.

Syntax

geometry_dump[]  ST_DumpPoints(geometry geom);

Parameters

ParameterDescription
geomThe input geometry.

Description

The path field is a 1-based integer array that identifies the position of each point within the input geometry:

  • LineString: returns {i}, where i is the 1-based index of the point within the LineString.

  • Polygon: returns {i, j}, where i is the 1-based index of the ring (1 = exterior ring) and j is the 1-based index of the point within that ring.

ST_DumpPoints supports circular strings, curves, polyhedral surfaces, triangles, triangulated irregular network (TIN) surfaces, and 3D objects.

Examples

The following example dumps the points of a MULTILINESTRING. The first element of each path value identifies the line (1 or 2), and the second identifies the point within that line.

SELECT (t.dump).path, ST_AsText((t.dump).geom)
FROM (
    SELECT ST_DumpPoints('MULTILINESTRING((0 0,0 2),(0 1,0 3))'::geometry) AS dump
) AS t;

Output:

 path  | st_astext
-------+------------
 {1,1} | POINT(0 0)
 {1,2} | POINT(0 2)
 {2,1} | POINT(0 1)
 {2,2} | POINT(0 3)
(4 rows)