ArcGIS Server Banner

ST_PointFromWKB

ST_PointFromWKB

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback
Note: This topic was updated for 9.3.1.

Definition

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

Syntax

Oracle

sde.st_pointfromwkb (wkb blob, srid integer)

PostgreSQL

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, 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.

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 st_point, wkb bytea);

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

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

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

UPDATE sample_points
SET wkb = 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, st_astext (st_pointfromwkb(wkb, 0)) AS points
FROM sample_points;

id points

10 POINT (44 14) 
11 POINT (24 13)

See Also

  • An overview of SQL functions used with ST_Geometry types