ST_Force3DZ

更新时间:
复制 MD 格式

Forces a geometry object into XYZ (3D) mode.

Syntax

geometry ST_Force3DZ(geometry geomA);

Parameters

ParameterDescription
geomAThe geometry object to convert to 3D.

Description

If the input geometry has no Z coordinates, all Z coordinates in the output are set to 0.

ST_Force3DZ supports the following geometry types:

  • Circular strings

  • Curves

  • Polyhedral surfaces

  • 3D objects

Examples

Convert a 2D point to 3D. Because the input has no Z coordinate, the output Z value defaults to 0:

SELECT ST_AsEWKT(ST_Force3DZ(ST_GeomFromEWKT('POINT(1 2)')));
  st_asewkt
--------------
 POINT(1 2 0)
(1 row)