ST_GeometryType
Definition
Mit ST_GeometryType wird anhand eines ST_Geometry-Objekts dessen Geometrietyp als Zeichenfolge zurückgegeben.
Syntax
sde.st_geometrytype (g1 sde.st_geometry)
Rückgabetyp
Varchar(32) mit einem der folgenden Objekte:
- ST_Point
- ST_LineString
- ST_Polygon
- ST_MultiPoint
- ST_MultiLineString
- ST_MultiPolygon
Beispiel
Die Tabelle "geometrytype_test" enthält die Geometrie-Spalte "g1".
Mit der INSERT-Anweisung wird jede Geometrie-Subclass in die Spalte "g1" eingefügt.
CREATE TABLE geometrytype_test (g1 sde.st_geometry);
INSERT INTO geometrytype_test VALUES (
sde.st_geometry ('point (10.02 20.01)', 0)
);
INSERT INTO geometrytype_test VALUES (
sde.st_geometry ('linestring (10.01 20.01, 10.01 30.01, 10.01 40.01)', 0)
);
INSERT INTO geometrytype_test VALUES (
sde.st_geometry ('polygon ((10.02 20.01, 11.92 35.64, 25.02 34.15,
19.15 33.94, 10.02 20.01))', 0)
);
INSERT INTO geometrytype_test VALUES (
sde.st_geometry ('multipoint (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);
INSERT INTO geometrytype_test VALUES (
sde.st_geometry ('multilinestring ((10.02 20.01, 10.32 23.98,
11.92 25.64), (9.55 23.75, 15.36 30.11))', 0)
);
INSERT INTO geometrytype_test VALUES (
sde.st_geometry ('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 Abfrage wird der Geometrietyp jeder in der Geometrie-Spalte "g1" gespeicherten Subclass aufgelistet.
Oracle
SELECT UPPER (sde.st_geometrytype (g1)) Geometry_type
FROM GEOMETRYTYPE_TEST;
Geometry_type
ST_POINT
ST_LINESTRING
ST_POLYGON
ST_MULTIPOINT
ST_MULTILINESTRING
ST_MULTIPOLYGON
PostgreSQL
SELECT (sde.st_geometrytype (g1)) AS Geometry_type
FROM geometrytype_test;
Geometry_type
ST_POINT
ST_LINESTRING
ST_POLYGON
ST_MULTIPOINT
ST_MULTILINESTRING
ST_MULTIPOLYGON
9/12/2013