[tz] [PATCH 0/1] Add Asia/Beijing
Alan Mintz
Alan_Mintz+TZ_IANA at Earthlink.net
Tue Aug 14 15:07:04 UTC 2012
At 2012-08-13 13:39, Guy Harris wrote:
>According to
>
> http://www.geonames.org/export/web-services.html
>
>one service they offer is "Timezone":
>
> > Timezone
> >
> > Webservice Type : REST
> > Url : api.geonames.org/timezone?
> > Parameters : lat,lng, radius (buffer in km for closest timezone in
> coastal areas), date (date for sunrise/sunset);
> > Result : the timezone at the lat/lng with gmt offset (1. January) and
> dst offset (1. July)
> > Example http://api.geonames.org/timezone?lat=47.01&lng=10.2&username=demo
This seems like a decent solution. If using the online APIs, to search for
a particular placename, use http://api.geonames.org/search?name=xxxxx . To
avoid a second API call to lookup the timezone from the resulting lat/lon,
you can specify the style=FULL param, which will include the <timezone>
element in the result.
Also, if the search yields multiple results and you didn't spec style=FULL
in the search query, get the record selected by the user by geonameId with
http://api.geonames.org/get?geonameId=nnnnn&style=FULL .
It's probably worthwhile to download the database and check for accuracy of
the lat/lon mapping. A couple of spot checks with US state borders showed
there _might_ be some issue with accuracy.
--
Alan Mintz <Alan_Mintz+TZ_IANA at Earthlink.net>
More information about the tz
mailing list