GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
How to use longitude/latitude to lookup country / timezone in allCountries.txt ?  XML
Forum Index -> General
Author Message
smallufo



Joined: 05/11/2009 22:46:06
Messages: 1
Offline

Hi
I know geonames provides handy webservices for me to query , such as :
http://ws.geonames.org/timezone?lat=25.03&lng=121.3

But the service seems unreliable , sometimes un-connectable ...

I need a reliable service.

So I download allCountries.zip and unzip it , and export all data to MySQL , totally 6914549 rows.

But I wonder if there is an efficient algorithm to lookup some location's country code and timezone ?

I have some idea , but it is very computing-intensive and impractical .
How does ws.geonames.org/* services work ? Is there any algorithm ?

Thanks a lot.
gmseed



Joined: 18/11/2009 13:23:48
Messages: 2
Offline

Hi

I'm similarly looking for a simple method call, like the GeoNames calls:

countryCode(lat,lon)
timezone(lat,lon)

without having to use the webservice.

Is there a siple way of doing this or has anyone else found analternative solution.

Thanks

Graham
gmseed



Joined: 18/11/2009 13:23:48
Messages: 2
Offline

Hi

I just downloaded the tzdata file from:

http://www.twinsun.com/tz/tz-link.htm

ftp://elsie.nci.nih.gov/pub/

and looked inside file "zone.tab", which lists the (lat,lon) for all of the country codes in "iso3166.tab".

The problem then reduces to finding the zone that a user specified (lat,lon) falls within.

I was thinking of building a kdtree of (lat,lon) positions with country codes as values and then doing a range-search type query for a given user specified (lat,lon).

What do you think?


Graham
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team