5. Geospatial Functions : GeomCollFromText
 
Share this page                  
GeomCollFromText
GEOMCOLLFROMTEXT(s string [, srid integer])
Alias: ST_GEOMCOLLFROMTEXT
Returns a geometry collection that corresponds to the Well Known Text (WKT) in s. The SRID can optionally be specified; it is ‑1 by default.
Result type: geometry
Example:
SELECT ASTEXT(GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(0 0, 0 10), POLYGON((2 2, 4 2, 4 4, 2 4, 2 2)))'));
--------------------------------
col1
--------------------------------
GEOMETRYCOLLECTION (LINESTRING (0 0, 0 10), POLYGON ((2 2, 4 2, 4 4, 2 4, 2 2)))
--------------------------------