Guide d'utilisation et de référence

ST_Envelope

ST_Envelope utilise en entrée un objet de type géométrie et renvoie la boîte englobante sous forme de géométrie.

Syntaxe

db2gse.ST_Envelope(g db2gse.ST_Geometry)

Type de retour

db2gse.ST_Geometry

Exemples

La colonne GEOTYPE de la table ENVELOPE_TEST stocke le nom de la sous-classe de la géométrie enregistrée dans la colonne de géométrie G1.

CREATE TABLE ENVELOPE_TEST (geotype varchar(20), g1 db2gse.ST_Geometry)

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

INSERT INTO ENVELOPE_TEST
VALUES('Point',
       db2gse.ST_PointFromText('point (10.02 20.01)', 
      db2gse.coordref()..srid(0)))
 
INSERT INTO ENVELOPE_TEST
VALUES('Linestring',
        db2gse.ST_LineFromText('linestring (10.01 20.01, 10.01 30.01, 
        10.01 40.01)', db2gse.coordref()..srid(0)))
 
INSERT INTO ENVELOPE_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 ENVELOPE_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 ENVELOPE_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 ENVELOPE_TEST
VALUES('Multilinestring',
       db2gse.ST_MLineFromText('multilinestring ((10.01 20.01,20.01 20.01,
       30.01 20.01), (30.01 20.01,40.01 20.01,50.01 20.01))',
                     db2gse.coordref()..srid(0)))
 
INSERT INTO ENVELOPE_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 ENVELOPE_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 à côté de son enveloppe. La fonction ST_Envelope renvoyant un point, une ligne ou un polygone, le résultat généré est converti en texte par la fonction ST_AsText. La fonction CAST permet de convertir la valeur varchar(4000) par défaut créée par la fonction ST_AsText en valeur varchar(280).

SELECT GEOTYPE, CAST(db2gse.ST_AsText(db2gse.ST_Envelope(g1)) AS
varchar(280)) "The envelope"
FROM ENVELOPE_TEST

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

GEOTYPE              The envelope
-------------------- ----------------------------------------------------------
Point                POINT ( 10.02000000 20.01000000)
Linestring           LINESTRING ( 10.01000000 20.01000000, 10.01000000
 40.01000000)
Linestring           POLYGON (( 10.02000000 20.01000000, 11.92000000
 20.01000000, 11.92000000 25.64000000, 10.02000000 25.64000000, 10.02000000
 20.01000000))
Polygon              POLYGON (( 10.02000000 20.01000000, 25.02000000
 20.01000000, 25.02000000 35.64000000, 10.02000000 35.64000000, 10.02000000
 20.01000000))
Multipoint           POLYGON (( 10.02000000 20.01000000, 11.92000000
 20.01000000, 11.92000000 25.64000000, 10.02000000 25.64000000, 10.02000000
 20.01000000))
Multilinestring      LINESTRING ( 10.01000000 20.01000000, 50.01000000
 20.01000000)
Multilinestring      POLYGON (( 9.55000000 20.01000000, 15.36000000
 20.01000000, 15.36000000 30.11000000, 9.55000000 30.11000000, 9.55000000
 20.01000000))
Multipolygon         POLYGON (( 10.02000000 20.01000000, 73.36000000
 20.01000000, 73.36000000 35.64000000, 10.02000000 35.64000000, 10.02000000
 20.01000000))
 
  8 record(s) selected.


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