The ST_Is3D() function
The SE_Is3d() function returns t (TRUE) if the ST_Geometry object has three-dimensional coordinates; otherwise, returns f (FALSE).
Properties of geometries are described in Properties of spatial data types.
Syntax
ST_Is3D(g1 ST_Geometry)
Return type
BOOLEAN
Example
The threed_test table is
created with INTEGER gid and g1 ST_Geometry columns:
CREATE TABLE threed_test (gid smallint,
g1 ST_Geometry);
The
following INSERT statements insert two points into the threed_test table.
The first point does not contain Z coordinates, while the second does:
INSERT INTO threed_test VALUES(
1, ST_PointFromText('point (10 10)',1000)
);
INSERT INTO threed_test VALUES(
1, ST_PointFromText('point z(10.92 10.12 5)',1000)
);
The query lists the contents of the gid column
with the results of the SE_Is3d function. The function returns
a 0 for the first row, which does not have a Z coordinate,
and a 1 for the second row, which does:
SELECT gid, ST_Is3D (g1) is_it_3d from threed_test;
gid is_it_3d
1 f
1 t