ST_Summary

更新时间:
复制 MD 格式

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

ParameterDescription
gThe 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:

FlagMeaning
MHas M coordinate
ZHas Z coordinate
BHas a cached bounding box
GIs a geography object
SHas a spatial reference system

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

Note

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.