PostGIS

ST_LinestringFromWKB

Prev

7.8.2. Well-Known Binary (WKB)

Next

Name

ST_LinestringFromWKB — Makes a geometry from WKB with the given SRID.

Synopsis

+geometry +ST_LinestringFromWKB(+`bytea `+WKB`)`;

+geometry +ST_LinestringFromWKB(+`bytea `+WKB, integer srid`)`;

Description

The ST_LinestringFromWKB function, takes a well-known binary representation of geometry and a Spatial Reference System ID (SRID) and creates an instance of the appropriate geometry type - in this case, a LINESTRING geometry. This function plays the role of the Geometry Factory in SQL.

If an SRID is not specified, it defaults to 0. NULL is returned if the input bytea does not represent a LINESTRING geometry. This an alias for ST_LineFromWKB.

Note

OGC SPEC 3.2.6.2 - optional SRID is from the conformance suite.

Note

If you know all your geometries are LINESTRING+`s, it's more efficient to just use link:ST_GeomFromWKB.html[ST_GeomFromWKB]. This function just calls link:ST_GeomFromWKB.html[ST_GeomFromWKB] and adds additional validation that it returns a `+LINESTRING.

[.inlinemediaobject]check This method implements the OGC Simple Features Implementation Specification for SQL 1.1.

s3.2.6.2

check This method implements the SQL/MM specification.

SQL-MM 3: 7.2.9

Examples

SELECT
  ST_LineStringFromWKB(
    ST_AsBinary(ST_GeomFromText('LINESTRING(1 2, 3 4)'))
  ) AS aline,
  ST_LinestringFromWKB(
    ST_AsBinary(ST_GeomFromText('POINT(1 2)'))
  ) IS NULL AS null_return;
   aline                            | null_return
------------------------------------------------
010200000002000000000000000000F ... | t

See Also

Prev

Up

Next

ST_LineFromWKB

Home

ST_PointFromWKB