[postgis-users] rookie question: how to extract latitude and longitude values from geography(POINT) column?

Kralidis,Tom [Ontario] Tom.Kralidis at ec.gc.ca
Wed Jan 5 07:08:43 PST 2011


 

> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net 
> [mailto:postgis-users-bounces at postgis.refractions.net] On 
> Behalf Of W. Matthew Wilson
> Sent: Wednesday, 05 January 2011 09:47
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] rookie question: how to extract 
> latitude and longitude values from geography(POINT) column?
> 
> I'm storing destinations as geography POINT columns.  Is 
> there some function that converts a geography(POINT) column's 
> latitude and longitude into plain numbers?
> 
>  I'm using google maps to draw markers on a map for these 
> destinations and I need to pass in the latitude and longitude 
> as a pair of numbers.


You can try:

# select ST_AsText(geom) from foo;

..which will give you WKT formatted output which you can parse.  More
geography type functions are at
http://postgis.refractions.net/documentation/manual-1.5/ch08.html#PostGI
S_GeographyFunctions

..Tom



More information about the postgis-users mailing list