ST_AsBinary function
The ST_AsBinary function takes a geometry as an input parameter and returns its well-known binary representation. The Z and M coordinates are discarded and will not be represented in the well-known binary representation.
If the given geometry is null, then null is returned.
This function can also be called as a method.
Syntax
Parameter
- geometry
- A value of type ST_Geometry or one of its subtypes to be converted to the corresponding well-known binary representation.
Return type
BLOB(2G)
Examples
The following code illustrates
how to use the ST_AsBinary function to convert the points in the geometry
columns of the SAMPLE_POINTS table into well-known binary (WKB) representation
in the BLOB column.
CREATE TABLE SAMPLE_POINTS (id integer, geometry ST_POINT, wkb BLOB(32K))
INSERT INTO SAMPLE_POINTS (id, geometry)
VALUES
(1100, ST_Point(10, 20, 1))