ST_AsBinary function
The ST_AsBinary function takes a geometry as an input parameter and returns its well-known binary format. The Z and M coordinates are discarded and will not be represented in the well-known binary format.
If the specified geometry is null, then null is returned.
Syntax
Parameter
- geometry
- A value of type ST_Geometry or one of its subtypes to be converted to the corresponding well-known binary format.
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) format
in a binary column.
CREATE TABLE SAMPLE_POINTS (id integer, geometry ST_POINT, wkb varbinary(32000))
INSERT INTO SAMPLE_POINTS (id, geometry) VALUES (1100, ST_Point(10, 20, 1))
