Guide d'utilisation et de référence

ST_GeomFromText

ST_GeomFromText utilise une représentation de texte connue (WKT) et un identificateur de système de références spatiales en entrée, et renvoie un objet de type géométrie.

Syntaxe

db2gse.ST_GeomFromText(geometryTaggedText Varchar(4000), SRID db2gse.coordref)

Type de retour

db2gse.ST_Geometry

Exemples

La table GEOMETRY_TEST contient la colonne de type entier GID qui identifie chaque ligne de manière univoque et la colonne G1 qui stocke la géométrie.

CREATE TABLE GEOMETRY_TEST (gid smallint, g1 db2gse.ST_Geometry)

Les instructions INSERT insèrent les données dans les colonnes GID et G1 de la table GEOMETRY_TEST. La fonction ST_GeomFromText convertit la représentation textuelle de chaque géométrie en la sous-classe instanciable Extension Spatiale correspondante.

INSERT INTO GEOMETRY_TEST
VALUES(1, db2gse.ST_GeomFromText('point (10.02 20.01)', 
     db2gse.coordref()..srid(0)))
 
INSERT INTO GEOMETRY_TEST
VALUES (2,
        db2gse.ST_GeomFromText('linestring (10.01 20.01, 10.01 30.01, 
        10.01 40.01)', db2gse.coordref()..srid(0)))
 
INSERT INTO GEOMETRY_TEST
VALUES(3,
       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 GEOMETRY_TEST
VALUES(4,
       db2gse.ST_GeomFromText('multipoint (10.02 20.01,10.32 23.98,
       11.92 25.64)', db2gse.coordref()..srid(0)))
 
INSERT INTO GEOMETRY_TEST
VALUES(5,
       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 GEOMETRY_TEST
VALUES(6,
       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)))


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