ST_MLineFromWKB

定义

ST_MLineFromWKB 以 ST_MultiLineString 类型的熟知二进制 (WKB) 表示和空间参考 ID 为输入参数,以创建 ST_MultiLineString 类型的对象。

语法

Oracle

sde.st_mlinefromwkb (wkb blob, srid integer)

PostgreSQL

sde.st_mlinefromwkb (wkb bytea, srid integer)

SQLite

st_mlinefromwkb (wkb blob, srid int32)

返回类型

ST_MultiLineString

示例

本示例说明了如何使用 ST_MLineFromWKB 由熟知二进制表示创建多线串。几何是空间参考系统 4326 中的一个多线串。在本示例中,多线串存储在 sample_mlines 表的几何列中且 ID = 10,然后利用熟知二进制表示对 wkb 列进行更新(使用 ST_AsBinary 函数)。最后,ST_MLineFromWKB 函数用于从 wkb 列中返回多线串。sample_mlines 表具有一个几何列(用于存储多线串)和一个 wkb 列(用于存储多线串的 WKB 表示)。

SELECT 语句包含 ST_MLineFromWKB 函数,该函数用于从 wkb 列检索多线串。

Oracle

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

INSERT INTO SAMPLE_MLINES (id, geometry) VALUES (
 10,
 sde.st_multilinestring ('multilinestring ((61 2, 64 3, 65 6), (58 4, 59 5, 61 8), (69 3, 67 4, 66 7, 68 9))', 4326)
);

UPDATE SAMPLE_MLINES
 SET wkb = sde.st_asbinary (geometry)
 WHERE id = 10;
SELECT id, sde.st_astext (sde.st_mlinefromwkb (wkb,0)) MULTI_LINE_STRING
 FROM SAMPLE_MLINES
 WHERE id = 10;

ID    MULTI_LINE_STRING

10    MULTILINESTRING ((61.00000000 2.00000000, 64.00000000 3.00000000, 65.00000000 6.00000000), (58.00000000 4.00000000, 59.00000000 5.00000000, 61.00000000 8.0000000), (69.00000000 3.00000000, 67.00000000 4.00000000, 66.00000000 7.00000000, 68.00000000 9.00000000 ))

PostgreSQL

CREATE TABLE sample_mlines (
 id integer,
 geometry sde.st_geometry,
 wkb bytea);

INSERT INTO sample_mlines (id, geometry) VALUES (
 10,
 sde.st_multilinestring ('multilinestring ((61 2, 64 3, 65 6), (58 4, 59 5, 61 8), (69 3, 67 4, 66 7, 68 9))', 4326)
);

UPDATE sample_mlines
 SET wkb = sde.st_asbinary (geometry)
 WHERE id = 10;
SELECT id, sde.st_astext (sde.st_mlinefromwkb (wkb,4326)) 
 AS MULTI_LINE_STRING
 FROM sample_mlines
 WHERE id = 10;

id   multi_line_string

10    MULTI_LINE_STRING ((61 2, 64 3, 65 6), (58 4, 59 5,61 8), (69 3, 67 4, 66 7, 68 9 ))

SQLite

CREATE TABLE sample_mlines (
 id integer,
 wkb blob);

SELECT AddGeometryColumn (
 NULL,
 'sample_mlines',
 'geometry',
 4326,
 'multilinestring',
 'xy',
 'null'
);

INSERT INTO sample_mlines (id, geometry) VALUES (
 10,
 st_multilinestring ('multilinestring ((61 2, 64 3, 65 6), (58 4, 59 5, 61 8), (69 3, 67 4, 66 7, 68 9))', 4326)
);

UPDATE sample_mlines
 SET wkb = st_asbinary (geometry)
 WHERE id = 10;
SELECT id, st_astext (st_mlinefromwkb (wkb,4326)) 
 AS MULTI_LINE_STRING
 FROM sample_mlines
 WHERE id = 10;

id   multi_line_string

10    MULTI_LINE_STRING ((61.00000000 2.00000000, 64.00000000 3.00000000, 65.00000000 6.00000000),
 (58.00000000 4.00000000, 59.00000000 5.00000000, 61.00000000 8.00000000),
 (69.00000000 3.00000000, 67.00000000 4.00000000, 66.00000000 7.00000000, 68.00000000 9.00000000 ))

相关主题

5/25/2014