定义
ST_MPointFromWKB 以 ST_MultiPolygon 类型的熟知二进制 (WKB) 表示和空间参考 ID 为输入参数,返回 ST_MultiPolygon 类型的对象。
语法
Oracle
sde.st_mpolyfromwkb (wkb blob, srid integer)
sde.st_mpolyfromwkb (wkb blob)
如果您未指定 SRID,则空间参考默认为 4326。
PostgreSQL
sde.st_mpolyfromwkb (wkb bytea, srid integer)
SQLite
st_mpolyfromwkb (wkb blob, srid int32)
st_mpolyfromwkb (wkb blob)
如果您未指定 SRID,则空间参考默认为 4326。
返回类型
ST_MultiPolygon
示例
本示例说明了如何使用 ST_MPolyFromWKB 由熟知二进制表示创建多面对象。几何是空间参考系统 4326 中的多面。在本示例中,多面存储在 sample_mpolys 表的几何列中且 ID = 10,然后利用熟知二进制表示对 wkb 列进行更新(使用 ST_AsBinary 函数)。最后,ST_MPolyFromWKB 函数用于从 wkb 列中返回多面。sample_mpolys 表格具有一个几何列(用于存储多面)和一个 wkb 列(用于存储多面的 WKB 表示)。
SELECT 语句包含 ST_MPolyFromWKB 函数,该函数用于从 WKB 列检索多面。
Oracle
CREATE TABLE sample_mpolys (
id integer,
geometry sde.st_geometry,
wkb blob
);
INSERT INTO SAMPLE_MPOLYS (id, geometry) VALUES (
10,
sde.st_multipolygon ('multipolygon (((1 72, 4 79, 5 76, 1 72), (10 20, 10 40, 30 41, 10 20), (9 43, 7 44, 6 47, 9 43)))', 4326)
);
UPDATE SAMPLE_MPOLYS
SET wkb = sde.st_asbinary (geometry)
WHERE id = 10;
SELECT id, sde.st_astext (sde.st_mpolyfromwkb (wkb,4326)) MULTIPOLYGON
FROM SAMPLE_MPOLYS
WHERE id = 10;
ID MULTIPOLYGON
10 MULTIPOLYGON (((10.00000000 20.00000000, 30.00000000 41.00000000, 10.00000000 40.00000000, 10.00000000 20.00000000)), (1.00000000 72.00000000, 5.00000000 76.00000000, 4.00000000 79.0000000, 1.00000000 72,00000000)), (9.00000000 43.00000000, 6.00000000 47.00000000, 7.00000000 44.00000000, 9.00000000 43.00000000 )))
PostgreSQL
CREATE TABLE sample_mpolys (
id integer,
geometry sde.st_geometry,
wkb bytea
);
INSERT INTO sample_mpolys (id, geometry) VALUES (
10,
sde.st_multipolygon ('multipolygon (((1 72, 4 79, 5 76, 1 72), (10 20, 10 40, 30 41, 10 20), (9 43, 7 44, 6 47, 9 43)))', 4326)
);
UPDATE sample_mpolys
SET wkb = sde.st_asbinary (geometry)
WHERE id = 10;
SELECT id, sde.st_astext (sde.st_mpolyfromwkb (wkb,4326))
AS MULTIPOLYGON
FROM sample_mpolys
WHERE id = 10;
id multipolygon
10 MULTIPOLYGON (((10 20, 30 41, 10 40, 10 20)),
((1 72, 5 76, 4 79, 1 72)), ((9 43, 6 47, 7 44, 9 43)))
SQLite
CREATE TABLE sample_mpolys (
id integer,
wkb blob
);
SELECT AddGeometryColumn(
NULL,
'sample_mpolys',
'geometry',
4326,
'multipolygon',
'xy',
'null'
);
INSERT INTO SAMPLE_MPOLYS (id, geometry) VALUES (
10,
st_multipolygon ('multipolygon (((1 72, 4 79, 5 76, 1 72), (10 20, 10 40, 30 41, 10 20), (9 43, 7 44, 6 47, 9 43)))', 4326)
);
UPDATE SAMPLE_MPOLYS
SET wkb = st_asbinary (geometry)
WHERE id = 10;
SELECT id, st_astext (st_mpolyfromwkb (wkb,4326))
AS "Multipolygon"
FROM sample_mpolys
WHERE id = 10;
id Multipolygon
10 MULTIPOLYGON ((( 10.00000000 20.00000000, 30.00000000 41.00000000, 10.00000000 40.00000000, 10.00000000 20.00000000)),
((1.00000000 72.00000000, 5.00000000 76.00000000, 4.00000000 79.00000000, 1.00000000 72.00000000)),
((9.00000000 43.00000000, 6.00000000 47.00000000, 7.00000000 44.00000000, 9.00000000 43.00000000)))