ST_PointFromWKB
ST_PointFromWKB takes a well-known binary representation of a point and a spatial reference system identifier as input parameters and returns the corresponding point.
If the given well-known binary representation is null, then null is returned.
Syntax
Parameters
- wkb
- A value of type BLOB(4M) that contains the well-known binary representation of the resulting point.
- srs_id
- A value of type INTEGER that identifies the spatial reference system for the resulting point.
Return type
db2gse.ST_Point
Example
This example illustrates how ST_PointFromWKB can be used to create a point from its well-known binary representation. The geometries are points in spatial reference system 1. In this example, the points get stored in the GEOMETRY column of the SAMPLE_POLYS table, and then the WKB column is updated with their well-known binary representations (using the ST_AsBinary function). Finally, the ST_PointFromWKB function is used to return the points from the WKB column.
The SAMPLE_POINTS
table has a GEOMETRY column, where the points are stored, and a WKB
column, where the points' well-known binary representations are stored.
SET CURRENT FUNCTION PATH = CURRENT FUNCTION PATH, db2gse
CREATE TABLE sample_points (id INTEGER, geometry ST_Point, wkb BLOB(32K))
INSERT INTO sample_points
VALUES (10, ST_Point ('point (44 14)', 1) ),
INSERT INTO sample_points
VALUES (11, ST_Point ('point (24 13)', 1))
UPDATE sample_points AS temporary_correlated
SET wkb = ST_AsBinary( geometry )
WHERE id = temporary_correlated.id
In the following SELECT statement, the ST_PointFromWKB
function is used to retrieve the points from the WKB column.
SELECT id, CAST( ST_AsText( ST_PointFromWKB (wkb) ) AS VARCHAR(35) ) POINTS
FROM sample_points
Results:
ID POINTS
---------- -----------------------------------
10 POINT ( 44.00000000 14.00000000)
11 POINT ( 24.00000000 13.00000000)