ST_CoordDim
Definition
ST_CoordDim gibt die Dimensionen von Koordinatenwerten für eine ST_Geometry-Spalte zurück.
Syntax
sde.st_coorddim (g1 sde.st_geometry)
Rückgabetyp
Ganzzahl
Beispiel
Die Tabelle "coorddim_test" wird mit den Spalten "geotype" und "g1" erstellt. In der Spalte "geotype" wird der Name der Geometrie-Subclass gespeichert, die in der ST_Geometry-Spalte "g1" gespeichert ist.
CREATE TABLE coorddim_test (geotype varchar(20), g1 sde.st_geometry);
Oracle
INSERT INTO COORDDIM_TEST VALUES (
'Point',
sde.st_pointfromtext ('point (10.02 20.01)', 0)
);
INSERT INTO COORDDIM_TEST VALUES (
'LineString',
sde.st_linefromtext ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);
INSERT INTO COORDDIM_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 COORDDIM_TEST VALUES (
'MultiPoint',
sde.st_mpointfromtext ('multipoint (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);
INSERT INTO COORDDIM_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 COORDDIM_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
INSERT INTO coorddim_test VALUES (
'Point',
st_point ('point (10.02 20.01)', 0)
);
INSERT INTO coorddim_test VALUES (
'LineString',
st_linestring ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);
INSERT INTO coorddim_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 coorddim_test VALUES (
'MultiPoint',
st_multipoint ('multipoint (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);
INSERT INTO coorddim_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 coorddim_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)
);
Mit der SELECT-Anweisung werden der Subclass-Name, der in der Spalte "geotype" gespeichert ist, und die Dimension der Koordinaten dieser Geometrie aufgelistet. Alle erstellten Features enthielten nur X-, Y-Koordinaten, sodass ST_CoordDim 2 zurückgibt.
Oracle
SELECT geotype, sde.st_coorddim (g1) coordinate_dimension FROM COORDDIM_TEST; GEOTYPE coordinate_dimension Point 2 LineString 2 Polygon 2 MultiPoint 2 MultiLineString 2 MultiPolygon 2
PostgreSQL
SELECT geotype, st_coorddim (g1) AS coordinate_dimension FROM coorddim_test; geotype coordinate_dimension Point 2 LineString 2 Polygon 2 MultiPoint 2 MultiLineString 2 MultiPolygon 2
7/10/2012