名称

ST_GeogFromText — 从已知的文本表示或扩展 (WKT) 返回指定的地理值。

大纲

geography ST_GeogFromText(text EWKT);

描述

从已知的文本或扩展的已知的表示中返回地理对象。 如果未指定,则假定为 SRID 4326。 这是 ST_GeographyFromText 的别名。 点始终以经纬度形式表示。

示例

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)');
栅格输出
SRID=4267;POINT(-77.0092 38.889588)
Figure
Geometry figure for visual-st-geogfromtext-01