ST_Dimension - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).


ST_Dimension returns the inherent dimension of an input geometry. The inherent dimension is the dimension value of the subtype that is defined in the geometry.

For 3DM, 3DZ, and 4D geometry inputs, ST_Dimension returns the same result as for 2D geometry inputs.





A value of data type GEOMETRY or an expression that evaluates to a GEOMETRY type.

Return type

INTEGER representing the inherent dimension of geom.

If geom is null, then null is returned.

The values returned are as follows.

Returned value Geometry subtype


Returned if geom is a POINT or MULTIPOINT subtype


Returned if geom is a LINESTRING or MULTILINESTRING subtype.


Returned if geom is a POLYGON or MULTIPOLYGON subtype


Returned if geom is an empty GEOMETRYCOLLECTION subtype

Largest dimension of the components of the collection

Returned if geom is a GEOMETRYCOLLECTION subtype


The following SQL converts a well-known text (WKT) representation of a four-point LINESTRING to a GEOMETRY object and returns the dimension of the linestring.

SELECT ST_Dimension(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)'));
st_dimension ------------- 1