PostGISGeometry Input

ST_GeographyFromText

What is ST_GeographyFromText?

ST_GeographyFromText parses a WKT or EWKT string and returns a geography value. It is an alias for ST_GeogFromText.

SQL
ST_GeographyFromText(text EWKT) → geography

If no SRID is given, WGS84 (EPSG:4326) is assumed.

When would you use ST_GeographyFromText?

Use ST_GeographyFromText to build geography values from text input for applications that compute metre-accurate distances and areas on the ellipsoid. It is often preferred over ST_GeogFromText in codebases where verbose naming aids readability.

Like ST_GeogFromText, it is commonly called in migration scripts and data-seeding routines that produce geography columns from CSVs or API JSON payloads.

FAQs

Is ST_GeographyFromText the same as ST_GeogFromText?

Yes — aliases with identical behaviour. Choose whichever reads better in your codebase.

What SRID is assumed by default?

EPSG:4326 (WGS84).

Can I include Z or M ordinates?

Yes, using the EWKT forms POINTZ, POINTM, POINTZM with a matching coordinate count.

How do I cast back to geometry?

Use (geog::geometry). The resulting geometry retains the SRID and coordinate values.