GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Displaying latitudes and longitudes on webservice  XML
Forum Index -> FAQ - frequently asked questions
Author Message
Molin



Joined: 23/07/2008 08:13:54
Messages: 2
Offline

Hi there!

Can someone tell me how to display lat and long on webservcie in deg min sec format.
For example:
I have in my table lat and long written in DEG format as a POINT in PostgreSQL.
45.603333 represent 45deg36min12sec
So, my POINT which represent some citiy is
(45.60333,16.771666)
How to display on webservice this point in this format:
45º36'12" 16º46'18"

Thanks for help!
marc



Joined: 08/12/2005 07:39:47
Messages: 4412
Offline

Hi Molin

It is simple mathematics. Multiply with 60 to get the minutes, mulitply the remainder again with 60 to get the seconds.

Best

Marc

[WWW]
Molin



Joined: 23/07/2008 08:13:54
Messages: 2
Offline

Hi Marc,

my problem is not how to get deg min sec, but how to get symbols behind degrees (º), minutes (') and seconds ('') on the web.
I have in my table coordinates in DEG format (51.508333, 0.125277).This are the coordinates for London in table. Now, if I want to get coordinates of London in format degrees (º), minutes (') and seconds ('') on the web, what would my query have to look like.

For example, if I write:
select coordinates from cities where city='London';

I'll get this result
51.508333, 0.125277

and I would like to get something like this:
51° 30' 30'' 0° 7' 31''


Thank you for your time and help!

Molin
marc



Joined: 08/12/2005 07:39:47
Messages: 4412
Offline

As I said in my previous post. You have to do the calculation yourself. I don't know of any inbuilt database function to do this. If you don't want to do this on the application level you can write a stored procedure to do this for you on the database level.

Marc

[WWW]
 
Forum Index -> FAQ - frequently asked questions
Go to:   
Powered by JForum 2.1.5 © JForum Team