Fork me on GitHub

ST_Force3D

Signature

GEOMETRY ST_Force3D(GEOMETRY geom);

Description

Converts geom to a 3D Geometry by setting its nonexistent z-values to 0. Entirely 3D Geometries are returned untouched.

Examples

-- No effect on 3D Geometries:
SELECT ST_Force3D('POINT(-10 10 6)');
-- Answer:         POINT(-10 10 6)

SELECT ST_Force3D('POINT(-10 10)');
-- Answer:         POINT(-10 10 0)

SELECT ST_Force3D('LINESTRING(-10 10, 10 10 3)');
-- Answer:         LINESTRING(-10 10 0, 10 10 3)

SELECT ST_Force3D('POLYGON((2 2, 10 0 1, 10 5 1, 0 5 2, 2 2))');
-- Answer:         POLYGON((2 2 0, 10 0 1, 10 5 1, 0 5 2, 2 2 0))
See also