ST_AsBinary

Definition

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

Syntax

sde.st_asbinary (g1 sde.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 sde.st_geometry, wkb bytea);

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 	st_astext
1111     POINT (10 20) 

11/18/2013