Guide d'utilisation et de référence

ST_GeometryType

ST_GeometryType utilise un objet ST_Geometry en entrée, dont il renvoie le type sous forme de chaîne.

Syntaxe

db2gse.ST_GeometryType (g db2gse.ST_Geometry)

Type de retour

Varchar(4000)

Exemples

La table GEOMETRYTYPE_TEST contient la colonne de géométrie G1.

CREATE TABLE GEOMETRYTYPE_TEST(g1 db2gse.ST_Geometry)

Les instructions INSERT suivantes insèrent chaque sous-classe de géométrie dans la colonne G1.

INSERT INTO GEOMETRYTYPE_TEST
VALUES(db2gse.ST_GeomFromText('point (10.02 20.01)', 
       db2gse.coordref()..srid(0)))
 
INSERT INTO GEOMETRYTYPE_TEST
VALUES (db2gse.ST_GeomFromText('linestring (10.01 20.01, 10.01 30.01, 
        10.01 40.01)', db2gse.coordref()..srid(0)))
 
INSERT INTO GEOMETRYTYPE_TEST 
VALUES(db2gse.ST_Geometrytype_test values(db2gse.ST_GeomFromText('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 GEOMETRYTYPE_TEST
VALUES(db2gse.ST_GeomFromText('multipoint (10.02
 20.01,10.32 23.98,
       11.92 25.64)', db2gse.coordref()..srid(0)))
 
INSERT INTO GEOMETRYTYPE_TEST
VALUES(db2gse.ST_GeomFromText('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 GEOMETRYTYPE_TEST
VALUES(db2gse.ST_GeomFromText('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 répertorie le type de géométrie de chaque sous-classe enregistrée dans la colonne G1.

SELECT db2gse.ST_GeometryType(g1) "Geometry type" FROM GEOMETRYTYPE_TEST 

L'ensemble de résultats suivant est renvoyé :

Geometry type
--------------------------------
ST_Point
ST_LineString
ST_Polygon
ST_MultiPoint
ST_MultiLineString
ST_MultiPolygon
 
  6 record(s) selected.


[ Début de page | Page précédente | Page suivante | Table des matières | Index ]