Definition
ST_MPointFromWKB takes a well-known binary (WKB) representation of type ST_MultiPolygon and a spatial reference ID to return an ST_MultiPolygon.
Syntax
Oracle
sde.st_mpolyfromwkb (wkb blob, srid integer)
sde.st_mpolyfromwkb (wkb blob)
If you do not specify an SRID, the spatial reference defaults to 4326.
PostgreSQL
sde.st_mpolyfromwkb (wkb bytea, srid integer)
SQLite
st_mpolyfromwkb (wkb blob, srid int32)
st_mpolyfromwkb (wkb blob)
If you do not specify an SRID, the spatial reference defaults to 4326.
Return type
ST_MultiPolygon
Example
This example illustrates how ST_MPolyFromWKB can be used to create a multipolygon from its well-known binary representation. The geometry is a multipolygon in spatial reference system 4326. In this example, the multipolygon is stored with ID = 10 in the geometry column of the sample_mpolys table, then the wkb column is updated with its well-known binary representation (using the ST_AsBinary function). Finally, the ST_MPolyFromWKB function is used to return the multipolygon from the wkb column. The sample_mpolys table has a geometry column, where the multipolygon is stored, and a wkb column, where the multipolygon's WKB representation is stored.
The SELECT statement includes the ST_MPolyFromWKB function, which is used to retrieve the multipolygon from the WKB column.
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)))