Constructs a geometry object from a Well-Known Text (WKT) string.
Syntax
geometry ST_GeomFromText(text WKT);
geometry ST_GeomFromText(text WKT, integer srid);Parameters
| Parameter | Description |
|---|---|
WKT | The WKT string representing the geometry. |
srid | The spatial reference identifier (SRID) to assign to the geometry object. |
Description
This function supports circular strings and curves.
Examples
Construct a geometry object without an SRID
SELECT ST_GeomFromText('POINT(116 40)');Output:
st_geomfromtext
--------------------------------------------
01010000000000000000005D400000000000004440
(1 row)Construct a geometry object with a specified SRID
SELECT ST_GeomFromText('POINT(116 40)', 4326);Output:
st_geomfromtext
----------------------------------------------------
0101000020E61000000000000000005D400000000000004440
(1 row)该文章对您有帮助吗?