User's Guide and Reference

ST_WKTToSQL

ST_WKTToSQL constructs a ST_Geometry value given its well-known textual representation. An SRID value of 0 is automatically used.

Syntax

db2gse.ST_WKTToSQL(geometryTaggedText Varchar(4000))

Return type

db2gse.ST_Geometry

Examples

The following CREATE TABLE statement creates the GEOMETRY_TEST table, which contains two columns: the GID column of type integer, which uniquely identifies each row, and the G1 column, which stores the geometry.

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

The following INSERT statements insert the data into the GID and G1 columns of the GEOMETRY_TEST table. The ST_WKTToSQL function converts the text representation of each geometry into its corresponding DB2 Spatial Extender instantiable subclass.

INSERT INTO GEOMETRY_TEST VALUES( 
1, db2gse.ST_WKTToSQL ('point (10.02 20.01)') 
)
 
INSERT INTO GEOMETRY_TEST VALUES( 
2, db2gse.ST_WKTToSQL('linestring (10.01 20.01, 10.01 30.01, 10.01 40.01)') 
)
 
INSERT INTO GEOMETRY_TEST VALUES( 
3, db2gse.ST_WKTToSQL('polygon ((10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 
10.02 20.01))')
)
 
INSERT INTO GEOMETRY_TEST VALUES( 
4, db2gse.ST_WKTToSQL('multipoint (10.02 20.01,10.32 23.98,11.92 25.64)') 
)
 
INSERT INTO GEOMETRY_TEST VALUES( 
5, db2gse.ST_WKTToSQL('multilinestring ((10.02 20.01,      10.32 23.98,11.92 25.64),
(9.55 23.75,15.36 30.11))') 
)
 
INSERT INTO GEOMETRY_TEST VALUES( 
6, db2gse.ST_WKTToSQL('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)))')
)


[ Top of Page | Previous Page | Next Page ]