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)
sde.st_pointfromwkb (wkb blob)
If you do not specify an SRID, the spatial reference defaults to 4326.
PostgreSQL
sde.st_pointfromwkb (wkb bytea, srid integer)
SQLite
st_pointfromwkb (wkb blob, srid int32)
st_pointfromwkb (wkb blob)
If you do not specify an SRID, the spatial reference defaults to 4326.
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 4326. 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.
In the SELECT statement, the ST_PointFromWKB function is used to retrieve the points from the WKB column.
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)', 4326)
);
INSERT INTO SAMPLE_POINTS (id, geometry) VALUES (
11,
sde.st_point ('point (24 13)', 4326)
);
UPDATE SAMPLE_POINTS
SET wkb = sde.st_asbinary (geometry)
WHERE id = 10;
UPDATE SAMPLE_POINTS
SET wkb = sde.st_asbinary (geometry)
WHERE id = 11;
SELECT id, sde.st_astext (sde.st_pointfromwkb(wkb, 4326)) POINTS
FROM SAMPLE_POINTS;
ID POINTS
10 POINT (44.00000000 14.00000000)
11 POINT (24.00000000 13.00000000)
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)', 4326)
);
INSERT INTO sample_points (id, geometry) VALUES (
11,
sde.st_point ('point (24 13)', 4326)
);
UPDATE sample_points
SET wkb = sde.st_asbinary (geometry)
WHERE id = 10;
UPDATE sample_points
SET wkb = sde.st_asbinary (geometry)
WHERE id = 11;
SELECT id, sde.st_astext (sde.st_pointfromwkb(wkb, 4326))
AS points
FROM sample_points;
id points
10 POINT (44 14)
11 POINT (24 13)
SQLite
CREATE TABLE sample_pts (
id integer,
wkb blob
);
SELECT AddGeometryColumn(
NULL,
'sample_pts',
'geometry',
4326,
'point',
'xy',
'null'
);
INSERT INTO sample_pts (id, geometry) VALUES (
10,
st_point ('point (44 14)', 4326)
);
INSERT INTO sample_pts (id, geometry) VALUES (
11,
st_point ('point (24 13)', 4326)
);
UPDATE sample_pts
SET wkb = st_asbinary (geometry)
WHERE id = 10;
UPDATE sample_pts
SET wkb = st_asbinary (geometry)
WHERE id = 11;
SELECT id, st_astext (st_pointfromwkb(wkb, 4326))
AS "points"
FROM sample_pts;
id points
10 POINT (44.00000000 14.00000000)
11 POINT (24.00000000 13.00000000)