Was this helpful?
GeometryFromWKB
GEOMETRYFROMWKB(b binary [, srid integer])
Alias: GEOMFROMWKB, ST_GEOMETRYFROMWKB, ST_GEOMFROMWKB
Returns a geometry object that corresponds to the Well Known Binary (WKB) representation of the object given in b. The srid specifies the object's SRID. If left unspecified, the SRID returns -1. This function supports only geometries without Z or M coordinates.
Result type: geometry
Examples:
How do I insert results from ASBINARY into GEOMFROMWKB manually (for example, copy ASBINARY results and paste into GEOMFROMWKB)?
First specify the point using POINTFROMTEXT, then get the binary representation using ASBINARY, then specify the point using GEOMFROMWKB, and then display the point as text using ASTEXT.
SELECT ASTEXT(GEOMFROMWKB(ASBINARY(POINTFROMTEXT('POINT(1 2)'))));
--------------------------------
col1
--------------------------------
POINT (1 2)
--------------------------------
SRID of a point when it is not specified.
SELECT SRID(GEOMFROMWKB(ASBINARY(POINTFROMTEXT('POINT(1 2)'))));
-------------
col1
-------------
-1
-------------
SRID of a point when it is specified.
SELECT SRID(GEOMFROMWKB(ASBINARY(POINTFROMTEXT('POINT(1 2)')), 4955));
-------------
col1
-------------
4955
-------------
Last modified date: 04/03/2024