ST_PointFromWKB

Definition

ST_PointFromWKB takes a well-known binary (WKB) representation and a spatial reference ID to return an ST_Point.

Syntax

Oracle

sde.st_pointfromwkb (wkb blob, srid integer)

PostgreSQL

sde.st_pointfromwkb (wkb bytea, srid integer)

Return type

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 are stored in the geometry column of the sample_points table, 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.

Oracle

CREATE TABLE sample_points (id integer, geometry sde.st_point, wkb blob);

INSERT INTO SAMPLE_POINTS (id, geometry) VALUES (
10,
sde.st_point ('point (44 14)', 0)
);

INSERT INTO SAMPLE_POINTS (id, geometry) VALUES (
11,
sde.st_point ('point (24 13)', 0)
);

UPDATE SAMPLE_POINTS
SET wkb = sde.st_asbinary (geometry)
WHERE id = 10;

UPDATE SAMPLE_POINTS
SET wkb = sde.st_asbinary (geometry)
WHERE id = 11;

PostgreSQL

CREATE TABLE sample_points (id integer, geometry sde.st_point, wkb bytea);

INSERT INTO sample_points (id, geometry) VALUES (
10,
sde.st_point ('point (44 14)', 0)
);

INSERT INTO sample_points (id, geometry) VALUES (
11,
sde.st_point ('point (24 13)', 0)
);

UPDATE sample_points
SET wkb = sde.st_asbinary (geometry)
WHERE id = 10;

UPDATE sample_points
SET wkb = sde.st_asbinary (geometry)
WHERE id = 11;

In the following SELECT statement, the ST_PointFromWKB function is used to retrieve the points from the WKB column.

Oracle

SELECT id, sde.st_astext (sde.st_pointfromwkb(wkb, 0)) POINTS
FROM SAMPLE_POINTS;

ID POINTS

10 POINT (44.00000000 14.00000000) 
11 POINT (24.00000000 13.00000000)

PostgreSQL

SELECT id, sde.st_astext (sde.st_pointfromwkb(wkb, 0)) 
AS points
FROM sample_points;

id points

10 POINT (44 14) 
11 POINT (24 13)
6/19/2015