ST_DIMENSION
functionsupportedCore SQL functionsGiven a value of type GEOGRAPHY or GEOMETRY, return the “dimension” of the value. The dimension of a GEOGRAPHY or GEOMETRY value is: The returned values (0, 1, 2) correspond to the common meaning of the word “dimension”: a polygon is a two-dimensional object, a line is a one-dimensional object, and a point is a zero-dimensional object.
Syntax
ST_DIMENSION( <geography_or_geometry_expression> )
Parameters
| Name | Required | Description |
|---|---|---|
geography_or_geometry_expression | required | The argument must be an expression of type GEOGRAPHY or GEOMETRY. |
Returns
A value of type INTEGER.
Usage notes
- If the function is passed NULL, the function returns NULL.
- For GEOGRAPHY objects: If the function is passed a GeometryCollection containing at least one NULL element and no non-NULL elements, the function returns 0.
- If the function is passed a GeometryCollection containing at least one NULL element and at least one non-NULL element, the function returns the maximum dimension of the non-NULL elements.
- Note that some other systems return different values for NULL inputs.