PostGISGeometry Input
ST_LineFromWKB
What is ST_LineFromWKB?
ST_LineFromWKB parses a WKB byte string and returns a LINESTRING geometry. Non-LineString WKBs raise an error.
SQL
1ST_LineFromWKB(bytea wkb) → geometry
2ST_LineFromWKB(bytea wkb, integer srid) → geometryWhen would you use ST_LineFromWKB?
Use ST_LineFromWKB in typed ingestion pipelines for LineString-only streams. It is substantially faster than text-based constructors for bulk loads and ensures the geometry type matches expectations.
For flexibility across geometry types, use ST_GeomFromWKB.
FAQs
What's the difference from ST_LinestringFromWKB?
They are aliases. Both parse LineString WKB.
Does it validate self-intersection?
No. LineStrings are allowed to cross themselves; no OGC rule forbids it.
Is SRID required?
No — defaults to 0 unless EWKB is provided or the SRID is supplied.
Is it faster than ST_LineFromText?
Yes — WKB parsing is significantly faster.