ArcGIS Server Banner

ST_Dimension

ST_Dimension

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback
Note: This topic was updated for 9.3.1.

Definition

ST_Dimension returns the dimension of a geometry object.

Syntax

Oracle

sde.st_dimension (g1 sde.st_geometry)

PostgreSQL

st_dimension (g1 st_geometry)

Return type

Integer

Example

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

Oracle

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

INSERT INTO dimension_test VALUES (
'Point',
sde.st_pointfromtext ('point (10.02 20.01)', 0)
);

INSERT INTO dimension_test VALUES (
'Linestring',
sde.st_linefromtext ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO dimension_test VALUES (
'Polygon',
sde.st_polyfromtext ('polygon ((10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01))', 0)
);

INSERT INTO dimension_test VALUES (
'Multipoint',
sde.st_mpointfromtext ('multipoint (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO dimension_test VALUES (
'Multilinestring',
sde.st_mlinefromtext ('multilinestring ((10.02 20.01, 10.32 23.98, 11.92 25.64), (9.55 23.75, 15.36 30.11))', 0)
);

INSERT INTO dimension_test VALUES (
'Multipolygon',
sde.st_mpolyfromtext ('multipolygon (((10.02 20.01, 11.92 35.64, 25.02 34.15,
19.15 33.94, 10.02 20.01), (51.71 21.73, 73.36 27.04, 71.52 32.87,
52.43 31.90, 51.71 21.73)))', 0)
);

PostgreSQL

CREATE TABLE dimension_test (geotype varchar(20), g1 st_geometry);

INSERT INTO dimension_test VALUES (
'Point',
st_point ('point (10.02 20.01)', 0)
);

INSERT INTO dimension_test VALUES (
'Linestring',
st_linestring ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO dimension_test VALUES (
'Polygon',
st_polygon ('polygon ((10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01))', 0)
);

INSERT INTO dimension_test VALUES (
'Multipoint',
st_multipoint ('multipoint (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO dimension_test VALUES (
'Multilinestring',
st_multilinestring ('multilinestring ((10.02 20.01, 10.32 23.98, 11.92 25.64), (9.55 23.75, 15.36 30.11))', 0)
);

INSERT INTO dimension_test VALUES (
'Multipolygon',
st_multipolygon ('multipolygon (((10.02 20.01, 11.92 35.64, 25.02 34.15,
19.15 33.94, 10.02 20.01), (51.71 21.73, 73.36 27.04, 71.52 32.87,
52.43 31.90, 51.71 21.73)))', 0)
);

The SELECT statement lists the subclass name stored in the geotype column with the dimension of that geotype.

Oracle

SELECT geotype, sde.st_dimension (g1) Dimension
FROM dimension_test;

GEOTYPE                    Dimension

Point                       0
Linestring                  1
Polygon                     2
Multipoint                  0
Multilinestring             1
Multipolygon                2

PostgreSQL

SELECT geotype, st_dimension (g1) AS Dimension
FROM dimension_test;

geotype                  dimension

Point                       0
Linestring                  1
Polygon                     2
Multipoint                  0
Multilinestring             1
Multipolygon                2

See Also

  • An overview of SQL functions used with ST_Geometry types