How do I convert a latitude/longitude pair into a PostGIS geography type?

前端 未结 3 1955
我寻月下人不归
我寻月下人不归 2021-01-30 17:27

I\'m trying to load a bunch of latitude/longitude pairs into a PostGIS geography type so as to be able to query by location.

In particular I have a table with float lat

3条回答
  •  囚心锁ツ
    2021-01-30 18:00

    To perform exchange between lat and lng you may use:

    update mytable set geography = ST_GeographyFromText('SRID=4326;POINT(' || st_x(geom) || ' ' ||  st_y(geom) || ')');
    

    with or without srid.

提交回复
热议问题