Get Latitude and Longitude from Geometry Point in PostGres
How to get Longitude/Latitude from Geography Data in PostGIS
In the previous post I explained how to Convert Latitude, Longitude to Geography Point in PostGIS. Now I will show you how to get latitude, longitude form the geometry point data in PostGIS using simple query.
Select ST_Y(s."LatLng") as latitude, ST_X(s."LatLng") as longitude from "Site" s
For more documentation visit http://postgis.net/docs/manual-1.4/
Get Latitude and Longitude from Geometry Point in PostGres
Reviewed by Ravi Kumar
on
2:58 PM
Rating:

Hi. Just starting out with this, so bear with me. Could you explain what ST_Y and ST_X are?
ReplyDeletehello david,
ReplyDeleteST_Y: It returns the Y coordinate of the point, or NULL if not available.
and ST_X: It return the X coordinate of the point, or NULL if not available.
HI there how are you ? I am new to this and I managed to get my data and map to work but I don't know how to navigate through the map because I don't have the LongLat I tried your query but I am have an error with the (from "Site" ) part when I put my table name can you please help me? thank you a lot
ReplyDeleteHello sadeer!
DeleteI am fine, thank you. and hope you are fine as well. Try the below query with your table name:-
Select ST_Y(s."sp_geometry") as latitude, ST_X(s."sp_geometry") as longitude from "site" s