simonw / geocoders
- Source
- Commits
- Network (8)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
91c6dad
commit 91c6dad3b6ef2ebff6f661e8638712c51b00c689
tree 16767b0b240f7e453b3994396638fbb4cdd43be5
parent 99816fc1d25a53964dddf3376d76c356033874b6
tree 16767b0b240f7e453b3994396638fbb4cdd43be5
parent 99816fc1d25a53964dddf3376d76c356033874b6
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Tue May 26 16:01:57 -0700 2009 | |
| |
README.txt | Wed May 27 16:03:00 -0700 2009 | |
| |
__init__.py | Tue May 26 13:02:19 -0700 2009 | |
| |
geonames.py | Thu May 28 09:35:45 -0700 2009 | |
| |
google.py | Wed May 27 16:04:40 -0700 2009 | |
| |
multimap.py | Wed May 27 16:05:01 -0700 2009 | |
| |
placemaker.py | Tue May 26 16:42:34 -0700 2009 | |
| |
utils.py | Tue May 26 13:02:19 -0700 2009 | |
| |
yahoo.py | Tue May 26 16:42:34 -0700 2009 |
README.txt
Geocoders
=========
Code for accessing various geocoding web services with an ultra simple API:
name, (lat, lon) = geocode('london')
The geocode functions return (unicode_place_name, (float_lat, float_lon)) if
the string can be geocoded, and (None, (None, None)) if it cannot.
Currently supported: Google Geocoder, Yahoo! Geocoder, Yahoo! Placemaker,
GeoNames and Multimap.
Google:
>>> from geocoders.google import geocoder
>>> geocode = geocoder('GOOGLE-API-KEY')
>>> geocode('new york')
(u'New York, NY, USA', (40.756053999999999, -73.986951000000005))
>>> geocode('oneuth')
(u'South, Bloomfield, NY 14469, USA', (-77.5385449999999, 42.865267000000003))
Yahoo!:
>>> from geocoders.yahoo import geocoder
>>> geocode = geocoder('YAHOO-API-KEY')
>>> geocode('new york')
(u'New York, NY, US', (40.714550000000003, -74.007124000000005))
>>> geocode('oneuth')
(u'Aneth, UT 84510, US', (37.217799999999997, -109.189911))
Yahoo! Placemaker:
>>> from geocoders.placemaker import geocoder
>>> geocode = geocoder('YAHOO-API-KEY')
>>> geocode('new york')
(u'New York, NY, US', (40.714500000000001, -74.007099999999994))
>>> geocode('oneuth')
(None, (None, None))
While Yahoo! Placemaker isn't strictly designed as a geocoder, in practice it
can be useful for things like "did you mean location X" in a regular search
engine.
GeoNames:
>>> from geocoders.geonames import geocoder
>>> geocode('new york')
(u'New York', (40.714269100000003, -74.005972900000003))
>>> geocode('oneuth')
(None, (None, None))
Multimap:
>>> from geocoders.multimap import geocoder
>>> geocode = geocoder('MULTIMAP-API-KEY')
>>> geocode('new york')
('New York, State of New York, United States', ('43.00035', '-75.49990'))
>>> geocode('oneuth')
('Omeath, Louth', ('54.08790', '-6.26070'))