ArcGIS Server Banner

ST_LineFromWKB

ST_LineFromWKB

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback
Note: This topic was updated for 9.3.1.

Definition

ST_LineFromWKB takes a well-known binary (WKB) representation of type ST_LineString and a spatial reference ID and returns an ST_LineString.

Syntax

Oracle

sde.st_linefromwkb (wkb blob, srid integer)

PostgreSQL

st_linefromwkb (wkb bytea, srid integer)

Return type

ST_LineString

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. The following code uses the ST_LineFromWKB function to create and insert a line from a WKB representation. The row is inserted into the sample_lines table with an ID and a line in spatial reference system 1 in WKB representation.

Oracle

CREATE TABLE sample_lines (id smallint, geometry sde.st_linestring, wkb blob);

INSERT INTO sample_lines (id, geometry) VALUES (
1901,
sde.st_linestring ('linestring (850 250, 850 850)', 0)
);

INSERT INTO sample_lines (id, geometry) VALUES (
1902,
sde.st_linestring ('linestring (33 2, 34 3, 35 6)', 0)
);

UPDATE sample_lines
SET wkb = sde.st_asbinary (geometry)
WHERE id = 1901;

UPDATE sample_lines
SET wkb = sde.st_asbinary (geometry)
WHERE id = 1902;

SELECT id, sde.st_astext (sde.st_linefromwkb (wkb,0)) LINE
FROM sample_lines;

ID   LINE 

1901 LINESTRING (850.00000000 250.00000000, 850.00000000 850.00000000) 
1902 LINESTRING (33.00000000 2.00000000, 34.00000000 3.00000000, 35.00000000 6.00000000)

PostgreSQL

CREATE TABLE sample_lines (id integer, geometry st_linestring, wkb bytea);

INSERT INTO sample_lines (id, geometry) VALUES (
1901,
st_linestring ('linestring (850 250, 850 850)', 0)
);

INSERT INTO sample_lines (id, geometry) VALUES (
1902,
st_linestring ('linestring (33 2, 34 3, 35 6)', 0)
);

UPDATE sample_lines
SET wkb = st_asbinary (geometry)
WHERE id = 1901;

UPDATE sample_lines
SET wkb = st_asbinary (geometry)
WHERE id = 1902;

SELECT id, st_astext (st_linefromwkb (wkb,0)) AS LINE
FROM sample_lines;

id   line 

1901 LINESTRING (850 250, 850 850) 
1902 LINESTRING (33 2, 34 3, 35 6)

See Also

  • An overview of SQL functions used with ST_Geometry types