ST_GeogFromText
Name
ST_GeogFromText — Return a specified geography value from Well-Known Text representation or extended (WKT).
Synopsis
geography
ST_GeogFromText
(
text
EWKT
)
;
Description
Returns a geography object from the well-known text or extended well-known representation. SRID 4326 is assumed if unspecified. This is an alias for ST_GeographyFromText. Points are always expressed in long lat form.
Examples
Add a WGS 84 geography point column to a table.
Code
ALTER TABLE sometable ADD COLUMN geog geography(POINT, 4326);
Populate the geography column from longitude and latitude columns.
Code
UPDATE sometable
SET geog = ST_GeogFromText('SRID=4326;POINT(' || lon || ' ' || lat || ')');
Specify a geography point using EPSG:4267, NAD27.
Code
SELECT ST_GeogFromText('SRID=4267;POINT(-77.0092 38.889588)');
Output
SRID=4267;POINT(-77.0092 38.889588)