ST_GeomFromText()¶
ST_GeomFromText creates a geometry from Well-Known Text (WKT).
Syntax¶
ST_GeomFromText(wkt[, srid])
Aliases: ST_GeometryFromText().
Arguments¶
Argument |
Description |
|---|---|
|
VARCHAR, CHAR, or TEXT WKT; optional int64 SRID. |
|
Optional int64 spatial reference identifier. |
Return Value¶
Returns a GEOMETRY value.
Usage Notes¶
The optional SRID is accepted as an int64. Invalid WKT and unsupported geometry types are rejected. Source evidence: test/distributed/cases/geo/geo_io.sql and test/distributed/cases/geo/geo_srid.sql.
Examples¶
DROP DATABASE IF EXISTS geo_io_example;
CREATE DATABASE geo_io_example;
USE geo_io_example;
SELECT ST_AsText(ST_GeomFromText('POINT(1 2)', 4326)) AS wkt;
DROP DATABASE geo_io_example;
See Also¶
ST_AsText(), ST_GeomFromWKB().