User's Guide and Reference

ST_Boundary

ST_Boundary takes a geometry object and returns its combined boundary as a geometry object.

Syntax

db2gse.ST_Boundary(g db2gse.ST_Geometry)

Return type

db2gse.ST_Geometry

Examples

In the following code fragment, a table named BOUNDARY_TEST is created. BOUNDARY_TEST has two columns: GEOTYPE, which is defined as a varchar, and G1, which is defined as the superclass geometry. The INSERT statements that follow insert each one of the subclass geometries. The ST_Boundary function retrieves the boundary of each subclass that is stored in the G1 geometry column. Note that the dimension of the resulting geometry is always one less than the input geometry. Points and multipoints always result in a boundary that is an empty geometry, dimension 1. Linestrings and multilinestring return a multipoint boundary, dimension 0. A polygon or multipolygon always return a multilinestring boundary, dimension 1.

CREATE TABLE BOUNDARY_TEST (GEOTYPE varchar(20), G1 db2gse.ST_Geometry)
 
INSERT INTO BOUNDARY_TEST
VALUES('Point',
       db2gse.ST_PointFromText('point (10.02 20.01)',
                     db2gse.coordref()..srid(0)))
 
INSERT INTO BOUNDARY_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 BOUNDARY_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 BOUNDARY_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 BOUNDARY_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 BOUNDARY_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)))
 
SELECT GEOTYPE,
       CAST(db2gse.ST_AsText(db2gse.ST_Boundary (G1)) as varchar(280)) "The boundary"
FROM BOUNDARY_TEST
 
 
GEOTYPE              The boundary
-------------------- ----------------------------------------------------------
Point                POINT EMPTY
Linestring           MULTIPOINT ( 10.02000000 20.01000000, 11.92000000
 25.64000000)
Polygon              MULTILINESTRING (( 10.02000000 20.01000000, 19.15000000
 33.94000000, 25.02000000 34.15000000, 11.92000000 35.64000000, 10.02000000
 20.01000000))
Multipoint           POINT EMPTY
Multilinestring      MULTIPOINT ( 9.55000000 23.75000000, 10.02000000
 20.01000000, 11.92000000 25.64000000, 15.36000000 30.11000000)
Multipolygon         MULTILINESTRING (( 51.71000000 21.73000000, 73.36000000
 27.04000000, 71.52000000 32.87000000, 52.43000000 31.90000000, 51.71000000
 21.73000000),( 10.02000000 20.01000000, 19.15000000 33.94000000, 25.02000000
 34.15000000, 11.92000000 35.64000000, 10.02000000 20.01000000))
 
  6 record(s) selected.
 


[ Top of Page | Previous Page | Next Page ]