Returns a text summary of the contents of a geometry or geography object.
Syntax
text ST_Summary(geometry g);
text ST_Summary(geography g);Parameters
| Parameter | Description |
|---|---|
g | The geometry or geography object to inspect. |
Description
The output includes the geometry type followed by flags in square brackets, then structural details such as element count, ring count, and point count.
Flags in the output:
| Flag | Meaning |
|---|---|
M | Has M coordinate |
Z | Has Z coordinate |
B | Has a cached bounding box |
G | Is a geography object |
S | Has a spatial reference system |
ST_Summary supports circular strings, curves, polyhedral surfaces, triangles, triangulated irregular network (TIN) surfaces, and 3D objects.
Use MULTIPOLYGON instead of POLYHEDRALSURFACE to create polyhedral surfaces. For example: MULTIPOLYGON (((0 0 0, 1 0 0, 1 1 0, 0 1 0, 0 0 0)), ((1 0 0, 1 1 0, 1 1 1, 1 0 1, 1 0 0)), ((1 1 0, 0 1 0, 0 1 1, 1 1 1, 1 1 0)), ((0 1 0, 0 0 0, 0 0 1, 0 1 1, 0 1 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)))
Examples
Example 1: Default output for a geometry object
SELECT ST_Summary('MULTIPOLYGON(((1 0,0 3,3 0,1 0)),((1 0,2 0,0 2,1 0)))'::geometry);Output:
st_summary
---------------------------------
MultiPolygon[B] with 2 elements+
Polygon[] with 1 rings +
ring 0 has 4 points +
Polygon[] with 1 rings +
ring 0 has 4 points
(1 row)The [B] flag indicates a cached bounding box. No M, Z, G, or S flags appear because the input has no Z coordinates, is not a geography object, and has no spatial reference system.