ArcGIS Server Banner

ST_AsBinary

ST_AsBinary

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback

Definition

ST_AsBinary takes a geometry object and returns its well-known binary representation.

Syntax

Oracle

sde.st_asbinary (g1 sde.st_geometry)

PostgreSQL

st_asbinary (g1 st_geometry)

Return type

ST_Geometry

Example

This example populates the WKB column, with an ID of 1111, from the GEOMETRY column, with an ID of 1100.

Oracle

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

INSERT INTO SAMPLE_POINTS (id, geometry) VALUES (
1100,
sde.st_point (10, 20, 0)
);

INSERT INTO sample_points (id, wkb) VALUES (
1111,
(SELECT sde.st_asbinary (geometry) FROM sample_points WHERE id = 1100)
);

SELECT id, sde.st_astext (sde.st_geomfromwkb (wkb, 0))
FROM sample_points
WHERE id = 1111;

ID 	Point 
1111     POINT (10.00000000 20.00000000) 

PostgreSQL

CREATE TABLE sample_points (id integer, geometry st_geometry, wkb bytea);

INSERT INTO sample_points (id, geometry) VALUES (
1100,
st_point (10, 20, 0)
);

INSERT INTO sample_points (id, wkb) VALUES (
1111,
(SELECT st_asbinary (geometry) FROM sample_points WHERE id = 1100)
);

SELECT id, st_astext (st_geomfromwkb (wkb, 0))
FROM sample_points
WHERE id = 1111;

ID 	st_astext
1111     POINT (10 20) 

See Also

  • An overview of SQL functions used with ST_Geometry types