AsShape utilise en entrée un objet de type géométrie, dont elle renvoie la dimension.
Syntaxe
db2gse.ST_Dimension(g1 db2gse.ST_Geometry)
Type de retour
Integer
Exemples
La table DIMENSION_TEST est crée avec les colonnes GEOTYPE et G1. La colonne GEOTYPE stocke le nom de la sous-classe de la géométrie enregistrée dans la colonne de géométrie G1.
CREATE TABLE DIMENSION_TEST (geotype varchar(20), g1 db2gse.ST_Geometry)
Les instructions INSERT insèrent une sous-classe exemple dans la table DIMENSION_TEST.
INSERT INTO DIMENSION_TEST VALUES('Point', db2gse.ST_PointFromText('point (10.02 20.01)', db2gse.coordref()..srid(0))) INSERT INTO DIMENSION_TEST VALUES('Linestring', db2gse.ST_LineFromText('linestring (10.02 20.01,10.32 23.98, 11.92 25.64)', db2gse.coordref()..srid(0))) INSERT INTO DIMENSION_TEST VALUES('Polygon', db2gse.ST_PolyFromText('polygon ((10.02 20.01,11.92 35.64,25.02 34.15, 19.15 33.94,10.02 20.01))', db2gse.coordref()..srid(0))) INSERT INTO DIMENSION_TEST VALUES('Multipoint', db2gse.ST_MPointFromText('multipoint (10.02 20.01,10.32 23.98, 11.92 25.64)', db2gse.coordref()..srid(0))) INSERT INTO DIMENSION_TEST VALUES('Multilinestring', db2gse.ST_MLineFromText('multilinestring ((10.02 20.01,10.32 23.98, 11.92 25.64),(9.55 23.75,15.36 30.11))', db2gse.coordref()..srid(0))) INSERT INTO DIMENSION_TEST VALUES('Multipolygon', db2gse.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)))', db2gse.coordref)..srid(0)))
L'instruction SELECT ci-après affiche le nom de la sous-classe stocké dans la colonne geotype, accompagné de la dimension de ce type de géométrie.
SELECT geotype, db2gse.ST_Dimension(g1) "The dimension" FROM DIMENSION_TEST
L'ensemble de résultats suivant est renvoyé :
GEOTYPE The dimension -------------------- ------------- ST_Point 0 ST_Linestring 1 ST_Polygon 2 ST_Multipoint 0 ST_Multilinestring 1 ST_Multipolygon 2 6 record(s) selected.