ST_GeogFromText

更新时间:
复制 MD 格式

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

Syntax

geography  ST_GeogFromText(text  eWKT);

Parameters

ParameterDescription
eWKTThe WKT or EWKT string.

Description

  • If no spatial reference identifier (SRID) is specified, the default SRID 4326 is used.

  • ST_GeogFromText is equivalent to ST_GeographyFromText.

  • Point coordinates follow longitude-before-latitude order.

Examples

Construct a geography object using the default SRID 4326:

SELECT ST_SRID(ST_GeogFromText('POINT(116 40)'));
 st_srid
---------
    4326
(1 row)

Construct a geography object using a specified SRID:

SELECT ST_SRID(ST_GeogFromText('SRID=4256;POINT(116 40)'));
 st_srid
---------
    4256
(1 row)