ST_GeogFromWKB
What is ST_GeogFromWKB?
ST_GeogFromWKB parses a WKB or EWKB byte string and returns a geography value. If no SRID is present in the WKB header, WGS84 is assumed.
ST_GeogFromWKB(bytea wkb) → geographyBinary input is more compact and faster to parse than WKT, so it is the preferred format for bulk loading.
When would you use ST_GeogFromWKB?
Use ST_GeogFromWKB in ETL pipelines that move geography data from external formats — OGC WKB, protocol buffers, network streams — into PostGIS. Binary input avoids the text parsing overhead of ST_GeogFromText and preserves floating-point precision exactly.
It is also the right choice when interfacing with client libraries that emit WKB directly (most spatial ORMs and GIS frameworks do).
FAQs
What SRID does it assume?
If the WKB is EWKB with an embedded SRID, that SRID is used. Plain WKB without SRID defaults to EPSG:4326.
Is it faster than ST_GeogFromText?
Yes — binary parsing is much faster than WKT, especially for large geometries. For bulk loads the difference can be significant.
Does it validate geometry?
No. Validity is not checked. Run ST_IsValid on a geometry cast if needed.
How does it differ from ST_GeomFromWKB?
ST_GeogFromWKB returns geography; ST_GeomFromWKB returns geometry. Otherwise parsing is the same.