ST_MLineFromWKB

Definition

ST_MLineFromWKB takes a well-known binary (WKB) representation of type ST_MultiLineString and a spatial reference ID and creates an ST_MultiLineString.

Syntax

Oracle

sde.st_mlinefromwkb (wkb blob, srid integer)

PostgreSQL

sde.st_mlinefromwkb (wkb bytea, srid integer)

SQLite

st_mlinefromwkb (wkb blob, srid int32)

Return type

ST_MultiLineString

Example

This example illustrates how ST_MLineFromWKB can be used to create a multilinestring from its well-known binary representation. The geometry is a multilinestring in spatial reference system 4326. In this example, the multilinestring is stored with ID = 10 in the geometry column of the sample_mlines table, and the wkb column is updated with its well-known binary representation (using the ST_AsBinary function). Finally, the ST_MLineFromWKB function is used to return the multilinestring from the wkb column. The sample_mlines table has a geometry column, where the multilinestring is stored, and a wkb column, where the multilinestring's WKB representation is stored.

The SELECT statement includes the ST_MLineFromWKB function, which is used to retrieve the multilinestring from the wkb column.

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 ))

Related Topics

6/19/2015