Geospatial User Guide > Geospatial User Guide > Geospatial Functions > GeometryMFromText GeometryZFromText
Was this helpful?
GeometryMFromText
GEOMETRYMFROMTEXT(s string [, srid integer])
Alias: GEOMMFROMTEXT, ST_GEOMETRYMFROMTEXT, ST_GEOMMFROMTEXT
Returns a geometry object that corresponds to the Well Known Text (WKT) in s. The SRID can optionally be specified. It is ‑1 by default. This function only supports geometries that contains an M coordinate.
Result type: geometry
Examples:
SELECT ASTEXT(GEOMMFROMTEXT('MULTIPOINT M(0 1 5, 1 2 5, 3 5 5, 8 13 5)'));
--------------------------------
col1
--------------------------------
MULTIPOINT M (0 1 5, 1 2 5, 3 5 5, 8 13 5)
--------------------------------
SRID of point when it is not specified:
SELECT SRID(GEOMMFROMTEXT('POINT M(1 2 2)'));
-------------
col1
-------------
-1
-------------
SRID of point when it is specified:
SELECT SRID(GEOMMFROMTEXT('POINT M(1 2 2)', 4955));
-------------
col1
-------------
4955
-------------
GeometryMFromWKB
GEOMETRYMFROMWKB(b binary [, srid integer])
Alias: GEOMMFROMWKB, ST_GEOMETRYMFROMWKB, ST_GEOMMFROMWKB
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 only supports geometries with M coordinates.
Result type: geometry
Examples:
How do I insert results from ASBINARY into GEOMMFROMWKB manually (for example, copy ASBINARY results and paste into GEOMMFROMWKB)?
First specify the point using GEOMMFROMTEXT, then get the binary representation using ASBINARY, then specify the point using GEOMMFROMWKB, and then display the point as text using ASTEXT.
SELECT ASTEXT(GEOMMFROMWKB(ASBINARY(GEOMMFROMTEXT('POINT M(1 2 2)'))));
--------------------------------
col1
--------------------------------
POINT M (1 2 2)
--------------------------------
SRID of a point when it is not specified.
SELECT SRID(GEOMMFROMWKB(ASBINARY(GEOMMFROMTEXT('POINT M(1 2 2)'))));
-------------
col1
-------------
-1
-------------
SRID of a point when it is specified.
SELECT SRID(GEOMMFROMWKB(ASBINARY(GEOMMFROMTEXT('POINT M(1 2 2)')), 4955));
-------------
col1
GeometryZFromText
GEOMETRYZFROMTEXT(s string [, srid integer])
Alias: GEOMZFROMTEXT, ST_GEOMETRYZFROMTEXT, ST_GEOMZFROMTEXT
Returns a geometry object that corresponds to the Well Known Text (WKT) in s. The SRID can optionally be specified. It is ‑1 by default. This function only supports geometries that contains an Z coordinate.
Result type: geometry
Examples:
SELECT ASTEXT(GEOMZFROMTEXT('MULTIPOINT Z(0 1 5, 1 2 5, 3 5 5, 8 13 5)'));
--------------------------------
col1
--------------------------------
MULTIPOINT Z (0 1 5, 1 2 5, 3 5 5, 8 13 5)
--------------------------------
SRID of point when it is not specified:
SELECT SRID(GEOMZFROMTEXT('POINT Z(1 2 2)'));
-------------
col1
-------------
-1
-------------
SRID of point when it is specified:
SELECT SRID(GEOMZFROMTEXT('POINT Z(1 2 2)', 4955));
-------------
col1
-------------
4955
-------------
GeometryZFromWKB
GEOMETRYZFROMWKB(b binary [, srid integer])
Alias: GEOMZFROMWKB, ST_GEOMETRYZFROMWKB, ST_GEOMZFROMWKB
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 only supports geometries with Z coordinates.
Result type: geometry
Examples:
How do I insert results from ASBINARY into GEOMZFROMWKB manually (for example, copy ASBINARY results and paste into GEOMZFROMWKB)?
First specify the point using GEOMZFROMTEXT, then get the binary representation using ASBINARY, then specify the point using GEOMZFROMWKB, and then display the point as text using ASTEXT.
SELECT ASTEXT(GEOMZFROMWKB(ASBINARY(GEOMZFROMTEXT('POINT Z(1 2 2)'))));
--------------------------------
col1
--------------------------------
POINT Z (1 2 2)
--------------------------------
SRID of a point when it is not specified.
SELECT SRID(GEOMZFROMWKB(ASBINARY(GEOMZFROMTEXT('POINT Z(1 2 2)'))));
-------------
col1
-------------
-1
-------------
SRID of a point when it is specified.
SELECT SRID(GEOMZFROMWKB(ASBINARY(GEOMZFROMTEXT('POINT Z(1 2 2)')), 4955));
-------------
col1
-------------
Last modified date: 01/30/2023