This topic describes the ST_GeomFromText function. This function constructs a geometry object by using 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 that you want to specify.
srid The spatial reference identifier (SRID) of the geometry object.

Description

This function supports circular strings and curves.

Examples

  • Construct a geometry object by using the default parameter settings.
    SELECT ST_GeomFromText('POINT(116 40)');
                  st_geomfromtext
    --------------------------------------------
     01010000000000000000005D400000000000004440
    (1 row)
                        
  • Construct a geometry object by using a specified SRID.
    SELECT ST_GeomFromText('POINT(116 40)',4326);
                      st_geomfromtext
    ----------------------------------------------------
     0101000020E61000000000000000005D400000000000004440
    (1 row)