ST_Force2D

更新时间:
复制 MD 格式

Strips all dimensions except x and y from a geometry object, returning a 2D geometry.

Syntax

geometry ST_Force2D(geometry geomA);

Parameters

ParameterDescription
geomAThe geometry object to convert to 2D.

Description

  • The output geometry retains only the x and y coordinates.

  • Supported geometry types include circular strings, curves, polyhedral surfaces, triangles, triangulated irregular network (TIN) surfaces, and 3D objects.

Examples

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

Output:

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