ST_MLineFromWKB function
The ST_MLineFromWKB function takes a well-known binary (WKB) representation of a multilinestring and, optionally, a spatial reference system identifier as input parameters and returns the corresponding multilinestring.
If the specified WKB format is null, then null is returned.
The recommended function for achieving the same result is the ST_MultiLineString function. It is recommended because of its flexibility: ST_MultiLineString takes additional forms of input as well as the well-known binary format.
Syntax
Parameters
- wkb
- A value of type VARBINARY or BLOB(2G) that contains the well-known binary format of the resulting multilinestring.
- srs_id
- A value of type INTEGER that identifies the spatial reference
system for the resulting multilinestring.
If the srs_id parameter is omitted, the spatial reference system with the numeric identifier 4326 is used.
If the specified srs_id does not identify a spatial reference system listed in the catalog view SYSGEO.ST_SPATIAL_REFERENCE_SYSTEMS, then an exception condition is raised (SQLSTATE 38SU1).
Return type
ST_MultiLineString
Example
In the following example, the lines of results have been reformatted for readability. The spacing in your results will vary according to your online display.
- Line 1: (61, 2) (64, 3) (65, 6)
- Line 2: (58, 4) (59, 5) (61, 8)
- Line 3: (69, 3) (67, 4) (66, 7) (68, 9)
CREATE TABLE sample_mlines (id INTEGER, geometry ST_MultiLineString,
wkb varbinary(32000))
INSERT INTO sample_mlines
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) )', 1) )
UPDATE sample_mlines AS temporary_correlated
SET wkb = ST_AsBinary( geometry )
WHERE id = temporary_correlated.id
SELECT id, CAST( ST_AsText( ST_MLineFromWKB (wkb, 1) )
AS VARCHAR(280) ) MULTI_LINE_STRING
FROM sample_mlines
WHERE id = 10
ID MULTI_LINE_STRING
--- --------------------------------------------------------------------
10 MULTILINESTRING ((61.000000000 2.000000000, 64.000000000 3.000000000,
65.000000000 6.000000000),
(58.000000000 4.000000000, 59.000000000 5.000000000,
61.000000000 8.000000000),
(69.000000000 3.000000000, 67.000000000 4.000000000,
66.000000000 7.000000000, 68.000000000 9.000000000))