ST_Z
Determine the z coordinate of a point geometry, or sets the z coordinate of a point geometry to a particular value.
Syntax
ST_Z(pgeo);
ST_Z(pgeo, z);
- pgeo
- The input point geometry.
Type: ST_GEOMETRY(ANY)
- z
- The value to which the z coordinate of the input point geometry is to be set.
Type: DOUBLE
Returns
The value that is returned depends on whether an z value is specified:
- If an z value is not specified, a value of type DOUBLE that indicates the z coordinate of the input point geometry.
- If an z value is specified, a value of type ST_GEOMETRY(126) that contains the input point geometry with the newly set z coordinate.
Examples
SELECT inza..ST_Z(inza..ST_Point(0.0, 1.0, 2.0));
ST_Z
------
2
(1 row)
SELECT inza..ST_AsText(inza..ST_Z(inza..ST_Point(0.0, 1.0, 2.0), 5));
ST_ASTEXT
-----------
POINT Z (0 1 5)
(1 row)
SELECT inza..ST_AsText(inza..ST_Z(inza..ST_Point(0.0, 1.0), 5));
ST_ASTEXT
-----------
POINT Z (0 1 5)
(1 row)
SELECT inza..ST_AsText(inza..ST_Z(inza..ST_Point (3, 8, 23, 7, 4326), 40));
ST_ASTEXT
-----------
POINT ZM (3 8 40 7)
(1 row)