This topic describes the ST_GeogFromText function. This function constructs a geography object by using a standard Well-Known Text (WKT) string or an Extended Well-Known Text (EWKT) string.

Syntax

geography  ST_GeogFromText(text  eWKT);

Parameters

Parameter Description
eWKT The standard WKT string or EWKT string that you want to specify.

Description

  • If you do not specify a spatial reference identifier (SRID), the default SRID 4326 is used.
  • This function is equivalent to the ST_GeographyFromText function.
  • The coordinates of a point follow the order in which the longitude precedes the latitude.

Examples

  • Construct a geography object by using the default SRID 4326.
    SELECT ST_SRID(ST_GeogFromText('POINT(116 40)'));
     st_srid
    ---------
        4326
    (1 row)
                        
  • Construct a geography object by using a specified SRID.
    SELECT ST_SRID(ST_GeogFromText('SRID=4256;POINT(116 40)'));
     st_srid
    ---------
        4256
    (1 row)