This topic describes the ST_Dimension function. This function returns the dimension information about an object.

Syntax

int4 ST_Dimension(meshgeom geom);
int4 ST_Dimension(sfmesh sfmeshObject);

Parameters

ParameterDescription
geomThe meshgeom object.
sfmeshObjectThe sfmesh object.

Description

This function returns the maximum dimension value of an object. The following values may be returned based on OGC SF 1.2.1:
  • If the input object is a Point object, this function returns 0.
  • If the input object is a LineString object, this function returns 1.
  • If the input object is a Polygon object, this function returns 2.
  • If the input object is a meshgeom object, this function returns the maximum dimension value of all Patch-type objects.

Examples

select ST_Dimension('MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0,0 10,10 10,10 0), INDEX((0,1,2),(1,2,3)))))'::meshgeom);

--------------
            2