5. Geospatial Functions : GeometryFromText
 
Share this page                  
GeometryFromText
GEOMETRYFROMTEXT(s string [, srid integer])
Alias: GEOMFROMTEXT, ST_GEOMETRYFROMTEXT, ST_GEOMFROMTEXT
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.
Result type: geometry
Examples:
SELECT ASTEXT(GEOMFROMTEXT('MULTIPOINT(0 1, 1 2, 3 5, 8 13)'));
--------------------------------
col1
--------------------------------
MULTIPOINT (0 1, 1 2, 3 5, 8 13)
--------------------------------
SRID of point when it is not specified:
SELECT SRID(GEOMFROMTEXT('POINT(1 2)'));
-------------
col1
-------------
-1
-------------
SRID of point when it is specified:
SELECT SRID(GEOMFROMTEXT('POINT(1 2)', 4955));
-------------
col1
-------------
4955
-------------