The PostGIS ST_DumpPoints function seems to have enough data in the return value about the structure of geometries (in the path field):
It returns a set of geometry_dump rows, each containing a geometry (geom field) and an array of integers (path field).
the geom field POINTs represent the coordinates of the supplied geometry.
the path field (an integer[]) is an index enumerating the coordinate positions in the elements of the supplied geometry. The indices are 1-based. For example, for a LINESTRING the paths are {i} where i is the nth coordinate in the LINESTRING. For a POLYGON the paths are {i,j} where i is the ring number (1 is outer; inner rings follow) and j is the coordinate position in the ring.
Is there a function in PostGIS to reconstruct a specific type of geometry (e.g. MULTIPOLYGON
, or LINESTRING
) from its point dump table to get back the original geometry?
(I know ST_MakeLine, but I was wondering if there is a more general inverse of ST_Dump type functions.)