ST_Force2D

更新时间:
复制 MD 格式

Forces a geometry into 2D mode by stripping the z coordinate and returning only the x and y coordinates.

Syntax

geometry ST_Force2D(geometry geomA);

Parameters

ParameterDescription
geomAThe input geometry object.

Description

ST_Force2D strips the z coordinate from the input geometry and returns a 2D geometry containing only the x and y coordinates.

Supported input types: circular strings, curves, polyhedral surfaces, triangles, Triangulated Irregular Network (TIN) surfaces, and 3D objects.

Examples

Strip the z coordinate from a 3D point:

SELECT ST_AsEWKT(ST_Force2D(ST_GeomFromEWKT('POINT(1 2 3)')));

Output:

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