ST_PointFromText function
The ST_PointFromText function takes a well-known text representation of a point and, optionally, a spatial reference system identifier as input parameters and returns the corresponding point.
If the given well-known text representation is null, then null is returned.
The recommended function for achieving the same result is the ST_Point function. It is recommended because of its flexibility: ST_Point takes additional forms of input as well as the well-known text representation.
Syntax
Parameters
- wkt
- A value of type CLOB(2G) that contains the well-known text representation of the resulting point.
- srs_id
- A value of type INTEGER that identifies the spatial reference
system for the resulting point.
If the srs_id parameter is omitted, the spatial reference system with the numeric identifier 0 (zero) is used.
If srs_id does not identify a spatial reference system listed in the catalog view DB2GSE.ST_SPATIAL_REFERENCE_SYSTEMS, then an exception condition is raised (SQLSTATE 38SU1).
Return type
db2gse.ST_Point
Example
SET CURRENT FUNCTION PATH = CURRENT FUNCTION PATH, db2gse
CREATE TABLE sample_points (id INTEGER, geometry ST_Point)
INSERT INTO sample_points
VALUES (1110, ST_PointFromText ('point (30 40)', 1) )
The following SELECT statement returns the polygon that
was recorded in the table:
SELECT id, CAST( ST_AsText( geometry ) AS VARCHAR(35) ) POINTS
FROM sample_points
WHERE id = 1110
Results:
ID POINTS
---------- ---------------------------------------
1110 POINTS ( 30.00000000 40.00000000)