ST_Force3D

更新时间:
复制 MD 格式

Converts a geometry object to 3D (XYZ) format.

Syntax

geometry ST_Force3D(geometry geomA);

Parameters

ParameterDescription
geomAThe geometry object to convert.

Description

  • ST_Force3D is an alias for ST_Force_3DZ.

  • If the input has no z coordinates, all z values are set to 0.

  • Supports circular strings, curves, polyhedral surfaces, and 3D objects.

Examples

Convert a 2D point to 3D. The z coordinate is set to 0 because the input has no z value.

SELECT ST_AsEWKT(ST_Force3D(ST_GeomFromEWKT('POINT(1 2)')));

Output:

  st_asewkt
--------------
 POINT(1 2 0)
(1 row)