PDA

View Full Version : coordinate calculation


ioan
10-10-2006, 03:39 PM
I made an application to access Geocode webservice from http://www.zeesource.net/maps/geocoding.do (to be used with winmapper and maemo-mapper). The application works fine and returns the coordinates for any city in world (one point). For the application to be useful I need to be able to calculate top left corner and bottom right corner... for a 50miles radius (for example). What is the formula to do this?

Thanks
-ioan

mwiktowy
10-10-2006, 05:21 PM
Well ... a good ballpark place to start is to know that 1 arc-minute of latitude is 1 nautical mile at sea level. One arc-minute of longitude starts equal to this at the equator and decreases to zero at the poles by the cosine of the latitude.

This should give you a decent accuracy for just getting a rough box around a city.

lat+50nm = lat + 50*(1/60)deg

long+50nm = long + (50/cos(lat))*(1/60)deg

Realize that you are dividing by zero at the pole and there is no such thing as a latitude > 90 so limits have to be in place.

Or you can just stay in spherical coordinates ... I believe that is how Google maps tiles are arranged anyways being x deg of longitude wide and y deg of latitude high depending on the zoom level.

I recall there being a nice summary somewhere in the forum already ... probably written by gnuite. Might be difficult to locate since those maemo-mapper threads have taken on a life of their own :]

christianhauck
10-11-2006, 06:57 AM
ioan, you might also be intersted in that: http://live.gnome.org/GeoClue