ST_NDims — 返回几何图形的坐标维度。
integer ST_NDims(
geometry g1)
;
返回几何图形的坐标维度。PostGIS 支持 2 - (x,y)、3 - (x,y,z) 或带有度量的 2D - x,y,m,以及带有度量空间的 4 - 3D x,y,z,m
此函数支持 3D,并且不会丢弃 z 索引。
SELECT ST_NDims(ST_GeomFromText('POINT(1 1)')) As d2point, ST_NDims(ST_GeomFromEWKT('POINT(1 1 2)')) As d3point, ST_NDims(ST_GeomFromEWKT('POINTM(1 1 0.5)')) As d2pointm; d2point | d3point | d2pointm ---------+---------+---------- 2 | 3 | 3