ST_AsBinary

定义

ST_AsBinary 获取一个几何对象,然后返回其可识别的二进制表示。

语法

sde.st_asbinary (g1 sde.st_geometry)

返回类型

ST_Geometry

示例

本示例使用 ID 为 1100 的 GEOMETRY 列填充 ID 为 1111 的 WKB 列。

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/15/2013