ST_CoordDim

Definition

ST_CoordDim returns the dimensions of coordinate values for an ST_Geometry column.

Syntax

sde.st_coorddim (g1 sde.st_geometry)

Return type

Integer

2 = x,y coordinates

3 = x,y,z or x,y,m coordinates

4 = x,y,z,m coordinates

Example

The coorddim_test table is created with the columns geotype and g1. The geotype column stores the name of the geometry subclass stored in the g1 ST_Geometry column.

CREATE TABLE coorddim_test (geotype varchar(20), g1 sde.st_geometry);

Oracle

INSERT INTO COORDDIM_TEST VALUES (
'Point',
sde.st_geometry ('point (60.567222 -140.404)', 0)
);

INSERT INTO COORDDIM_TEST VALUES (
'Point Z',
sde.st_geometry ('point Z (60.567222 -140.404 5959)', 0)
);

INSERT INTO COORDDIM_TEST VALUES (
'Point M',
sde.st_geometry ('point M (60.567222 -140.404 5250)', 0)
);

INSERT INTO COORDDIM_TEST VALUES (
'Point ZM',
sde.st_geometry ('point ZM (60.567222 -140.404 5959 5250)', 0)
);

PostgreSQL

INSERT INTO coorddim_test VALUES (
'Point',
st_point ('point (60.567222 -140.404)', 0)
);

INSERT INTO coorddim_test VALUES (
'Point Z',
st_point ('point z (60.567222 -140.404 5959)', 0)
);

INSERT INTO coorddim_test VALUES (
'Point M',
st_point ('point m (60.567222 -140.404 5250)', 0)
);

INSERT INTO coorddim_test VALUES (
'Point ZM',
st_point ('point zm (60.567222 -140.404 5959 5250)', 0)
);

The SELECT statement lists the subclass name stored in the geotype column with the dimension of the coordinates of that geometry. All of the features created contained only x,y coordinates, so ST_CoordDim returns 2.

Oracle

SELECT geotype, sde.st_coorddim (g1) coordinate_dimension
FROM COORDDIM_TEST;

GEOTYPE               coordinate_dimension

Point                           2
Point Z                         3
Point M                         3
Point ZM                        4

PostgreSQL

SELECT geotype, st_coorddim (g1) 
AS coordinate_dimension
FROM coorddim_test;

geotype              coordinate_dimension

Point                          2
Point Z                        3
Point M                        3
Point ZM                       4
6/19/2015