ST_GeographyFromText

更新时间:
复制 MD 格式

Constructs a geography object from a Well-Known Text (WKT) or Extended Well-Known Text (EWKT) string.

Syntax

geography ST_GeographyFromText(text eWKT);

Parameters

ParameterDescription
eWKTThe WKT or EWKT string to parse.

Usage notes

  • If the input string does not include a spatial reference identifier (SRID), the function uses the default SRID 4326.

  • Coordinates follow longitude-before-latitude order.

Examples

Construct a geography object using the default SRID 4326:

SELECT ST_SRID(ST_GeographyFromText('POINT(116 40)'));

Output:

 st_srid
---------
    4326
(1 row)

Construct a geography object with a specified SRID:

SELECT ST_SRID(ST_GeographyFromText('SRID=4256;POINT(116 40)'));

Output:

 st_srid
---------
    4256
(1 row)