ST_CoordDim

更新时间: 2026-04-12 04:09:30

Returns the coordinate dimension of a meshgeom or sfmesh object.

Syntax

int2 ST_CoordDim(meshgeom geom);
int2 ST_CoordDim(sfmesh sfmeshObject);

Parameters

Parameter Type Description
geom meshgeom The meshgeom object.
sfmeshObject sfmesh The sfmesh object.

Description

ST_CoordDim returns the number of coordinate dimensions of a meshgeom or sfmesh object as an int2 value. A 3D object with X, Y, and Z coordinates returns 3.

Example

The following example queries the coordinate dimension of a 3D meshgeom object. Each vertex in the geometry has three coordinates (X, Y, Z), so the function returns 3.

SELECT ST_CoordDim('MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0 2,0 10 3,10 10 1,10 0 1), INDEX((0,1,2),(1,2,3)))))'::meshgeom);

Output:

-------------
            3
上一篇: ST_Dimension 下一篇: ST_NDims
阿里云首页 云原生数据库 PolarDB 相关技术圈