名前

ST_NDims — ジオメトリの座標次元をsmall intで返します。値は2, 3, 4のいずれかです。

概要

integer ST_NDims(geometry g1);

説明

ジオメトリの座標次元返します。PostGISでは、2 - (X,Y), 3 - (X,Y,Z), (X,Y,M), 4 - (X,Y,Z,M)に対応しています。

This function supports 3d and will not drop the z-index.

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
                        

関連情報

ST_CoordDim, ST_Dimension, ST_GeomFromEWKT