ST_ASBINARY

Converts shapes of the GEOGRAPHY data type to the Well-Known Binary (WKB) format for geographic objects.

Syntax

ST_ASBINARY(<object>)

Parameters

Parameter Description Supported input types
<object> The GEOGRAPHY object to convert to WKB format. GEOGRAPHY

Return Type

ST_ASBINARY returns a value of type BYTEA.

Example

The following query uses ST_GEOGFROMTEXT to create a GEOGRAPHY object from the WKT representation of a Point at specified longitude and latitude coordinates, and then uses ST_ASBINARY to convert it to WKB representation:

SELECT ST_ASBINARY(ST_GEOGFROMTEXT('POINT(-73.98551041593687 40.75793403395676)')) AS result

Returns

result (BYTEA)
‘\x01010000003d94479a127f52c0502f80fb03614440’