Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42373

Convert Latitude, Longitude To TimeZone

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <maccten2000@hotmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.044
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'i?m': 0.05; 'converts': 0.09; 'to)': 0.09; 'url:github': 0.09; 'url:blog': 0.10; 'python': 0.11; 'coordinates': 0.16; 'simple.': 0.16; 'skip:# 80': 0.16; 'skip:g 50': 0.16; 'subject:Convert': 0.16; 'utc': 0.16; 'zone.': 0.16; 'trying': 0.19; 'skip:g 40': 0.19; 'code,': 0.22; 'previously': 0.22; 'error': 0.23; 'somewhere': 0.26; 'defined': 0.27; 'function': 0.29; 'wondering': 0.29; '(this': 0.29; '----': 0.29; 'skip:g 30': 0.30; "i'm": 0.30; 'code': 0.31; 'piece': 0.31; 'anyone': 0.31; 'file': 0.32; 'probably': 0.32; 'run': 0.32; 'table': 0.34; 'basic': 0.35; 'something': 0.35; 'convert': 0.35; 'but': 0.35; 'there': 0.35; 'url:rec-html40': 0.35; 'charset:us- ascii': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'wrong': 0.37; 'url:microsoft': 0.37; 'being': 0.38; 'problems': 0.38; 'feed': 0.38; 'url:office': 0.38; 'to:addr:python-list': 0.38; 'url:schemas': 0.38; 'url:omml': 0.39; 'url:2004': 0.39; 'url:2012': 0.39; 'url:12': 0.39; 'to:addr:python.org': 0.39; 'days': 0.60; 'skip:u 10': 0.60; 'skip:2 20': 0.60; 'new': 0.61; 'places': 0.64; 'account': 0.65; 'linked': 0.65; 'within': 0.65; 'world': 0.66; '600': 0.68; 'latitude': 0.84; 'longitude': 0.84; 'stamp': 0.91; 'mistakes': 0.93
X-EIP [VyT+ZO3A5QC2fi+gJlTWDWnkjbwd4/fo]
X-Originating-Email [maccten2000@hotmail.com]
From Steve B <maccten2000@hotmail.com>
To <python-list@python.org>
Subject Convert Latitude, Longitude To TimeZone
Date Sun, 31 Mar 2013 16:53:14 +0200
MIME-Version 1.0
Content-Type multipart/alternative; boundary="----=_NextPart_000_000B_01CE2E30.3CC0F6B0"
X-Mailer Microsoft Outlook 14.0
Thread-Index Ac4uH1Z9+mKq9jFdTEy73lPQZqJk1Q==
Content-Language en-us
X-OriginalArrivalTime 31 Mar 2013 14:53:18.0122 (UTC) FILETIME=[7AE820A0:01CE2E1F]
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4017.1364741666.2939.python-list@python.org> (permalink)
Lines 178
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1364741666 news.xs4all.nl 6882 [2001:888:2000:d::a6]:49153
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:42373

Show key headers only | View raw


[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 | NextNext in thread | Find similar | Unroll thread


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