manbearwiz / Ayos

Python script to precisely control grow light fixtures according to your current locations sunrise and sunset.
3 stars 0 forks source link

Allow calculations based on address (geocoding) #1

Open manbearwiz opened 10 years ago

manbearwiz commented 10 years ago

Rather then specifying a latitude and longitude, allow the entering of an address and retrieve the lat and long based on that.

Promising Candidate Libraries

geopy - a Python 2 and 3 client for several popular geocoding web services.

pygeocoder - a Python library that helps you make use of Google's Geocoding functionality. With this module, you can easily find addresses corresponding to coordinates and vice versa.

manbearwiz commented 10 years ago

I was having issues installing pygeocoder on my system with pip. Some investigation has shown this to be the issue. Essentially it wont work on Python 3.0-3.2.X. Unfortunately Debian Wheezy (stable) is at Python 3.2.3-6.

manbearwiz commented 10 years ago

Attempting to use pyenv to install the latest version of python3.3 from the pyenv mirror site

manbearwiz commented 10 years ago

Looking into other packages.

python-googlegeocoder - A simple Python wrapper for version three of Google's geocoder API.

Geocoder - An Apache2 Licensed Geocoding library, written in Python.

manbearwiz commented 10 years ago

This example in the Geocoder readme stands out as a good default case for Ayos.

>>> g = geocoder.ip('me')
>>> g.address
'Ottawa, Ontario Canada'
>>> g.latlng
(45.4805, -75.5237)
manbearwiz commented 10 years ago

So I tried to use Geocoder and while it installed fine, dependency errors everywhere at runtime. This left python-googlegeocoder and while I wont be giving it any points for a unique name, it does do something the others failed at; working on my system. I'll probably contact the maintainers for the other packages but for right now I found something that works.