ST_MLineFromWKB
ST_MLineFromWKB takes a well-known binary representation of a multilinestring and a spatial reference system identifier as input parameters and returns the corresponding multilinestring.
If the given well-known binary representation is null, then null is returned.
Syntax
Parameters
- wkb
- A value of type BLOB(4M) that contains the well-known binary representation of the resulting multilinestring.
- srs_id
- A value of type INTEGER that identifies the spatial reference system for the resulting multilinestring.
Return type
db2gse.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.
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 1. In this example, the multilinestring
gets stored with ID = 10 in the GEOMETRY column of the SAMPLE_MLINES
table, and then 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 X and Y coordinates for this geometry are:
- 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)
The SAMPLE_MLINES table has a GEOMETRY column, where
the multilinestring is stored, and a WKB column, where the multilinestring's
well-known binary representation is stored.
SET CURRENT FUNCTION PATH = CURRENT FUNCTION PATH, db2gse
CREATE TABLE sample_mlines (id INTEGER, geometry ST_MultiLineString,
wkb BLOB(32K))
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
In the following SELECT statement, the ST_MLineFromWKB
function is used to retrieve the multilinestring from the WKB column.
SELECT id, CAST( ST_AsText( ST_MLineFromWKB (wkb) )
AS VARCHAR(280) ) MULTI_LINE_STRING
FROM sample_mlines
WHERE id = 10
Results:
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 ))
