[postgis-users] decimal degrees to dms

Don harterc1 at comcast.net
Tue Jan 26 04:01:44 PST 2010


I haven't been able to find a function that will convert a decimal
latitude or longitude to degrees minutes seconds.
Am I missing something?   I am doing a query and get complicated
expressions like
  lpad((round((((abs(long_wgs84)-floor(abs(long_wgs84)))*60::double
precision - floor((abs(long_wgs84)-floor(abs(long_wgs84)))*60::double
precision))*60::double precision)::numeric,1)*10::real)::text,3,'0')

for seconds decimal rounded*10 padded

to get the seconds for the following format ddmmsss.



More information about the postgis-users mailing list