ST_AsBinary

Définition

ST_AsBinary accepte un objet géométrie et retourne sa représentation binaire connue.

Syntaxe

sde.st_asbinary (g1 sde.st_geometry)

Type de retour

ST_Geometry

Exemple

Cet exemple renseigne la colonne WKB, ayant un identifiant de 1111, à partir de la colonne GEOMETRY, ayant un identifiant de 1100.

Oracle

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

INSERT INTO SAMPLE_POINTS (id, geometry) VALUES (
1100,
sde.st_geometry ('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)
9/12/2013