ST_AsWKB()

ST_AsWKB returns the WKB binary representation of a geometry.

Syntax

ST_AsWKB(geom)

Aliases: ST_AsBinary().

Arguments

Argument

Description

geom

GEOMETRY or GEOMETRY32.

Return Value

Returns a BLOB value.

Usage Notes

Use the returned binary with ST_GeomFromWKB for a WKB round trip. Source evidence: test/distributed/cases/geo/geo_io.sql and test/distributed/cases/geo/geo_constructors.sql.

Examples

DROP DATABASE IF EXISTS geo_io_example;
CREATE DATABASE geo_io_example;
USE geo_io_example;

SELECT ST_AsText(ST_GeomFromWKB(ST_AsWKB(ST_GeomFromText('POINT(1 2)')))) AS wkt;

DROP DATABASE geo_io_example;

See Also

ST_GeomFromWKB(), ST_AsText().