Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42373
| From | Steve B <maccten2000@hotmail.com> |
|---|---|
| Subject | Convert Latitude, Longitude To TimeZone |
| Date | 2013-03-31 16:53 +0200 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4017.1364741666.2939.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
Hi All
I'm new to python (4 days J) and was wondering if anyone out there can help
me
I am trying to get the time zones for latitude and longitude coordinates
but am having a few problems
The mistakes are probably very basic
I have a table in a database with around 600 rows. Each row contains a lat
long coordinate for somewhere in the world
I want to feed these co-ordinates into a function and then retrieve the time
zone. The aim being to convert events which have a local time stamp within
each of these 600 places into UTC time
I found a piece of code
[http://blog.pamelafox.org/2012/04/converting-addresses-to-timezones-in.html
] which uses the function [https://gist.github.com/pamelafox/2288222]
When I try to run the code, I get the error geonames is not defined (This is
the function previously linked to)
I have applied for an account with geonames, I think I have just saved the
function file in the wrong directory or something simple. Can anyone help
#---------------------------------------------------------------------------
----
# Converts latitude longitude into a time zone
# REF: https://gist.github.com/pamelafox/2288222
# REF:
http://blog.pamelafox.org/2012/04/converting-addresses-to-timezones-in.html
#---------------------------------------------------------------------------
----
geonames_client = geonames.GeonamesClient('Username_alpha')
geonames_result = geonames_client.find_timezone({'lat': 48.871236, 'lng':
2.77928})
user.timezone = geonames_result['timezoneId']
Thanks
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Convert Latitude, Longitude To TimeZone Steve B <maccten2000@hotmail.com> - 2013-03-31 16:53 +0200 Re: Convert Latitude, Longitude To TimeZone Roy Smith <roy@panix.com> - 2013-03-31 11:09 -0400
csiph-web