Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/azavea/python-omgeo
OMGeocoder - A python geocoding abstraction layer
https://github.com/azavea/python-omgeo
geocode geocoder geocoding python
Last synced: about 2 months ago
JSON representation
OMGeocoder - A python geocoding abstraction layer
- Host: GitHub
- URL: https://github.com/azavea/python-omgeo
- Owner: azavea
- License: mit
- Created: 2012-03-09T21:31:15.000Z (almost 13 years ago)
- Default Branch: develop
- Last Pushed: 2024-04-19T15:55:41.000Z (9 months ago)
- Last Synced: 2024-06-11T18:39:12.974Z (7 months ago)
- Topics: geocode, geocoder, geocoding, python
- Language: Python
- Homepage: http://python-omgeo.readthedocs.io/en/latest/
- Size: 1.07 MB
- Stars: 36
- Watchers: 37
- Forks: 12
- Open Issues: 13
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
**OMGeo - Python Edition**
``python-omgeo`` is a geocoding abstraction layer written in python. Currently
supported geocoders:* `US Census Geocoder `_
* `Bing Maps REST Locations API `_
* `ESRI World Geocoding Service `_
* `MapQuest Licensed Data API `_
* `MapQuest-hosted Nominatim Open Data API `_
* `Pelias geocoder `_. Defaults to use `geocode.earth `_
* `Google geocoder `_.. NOTE::
Check out `this project's page on GitHub `_.**Installation**::
sudo pip install python-omgeo
**Documentation**
Docs are available in `HTML `_
or `PDF `_ format.**Usage Example**
Make a new geocoder and geocode and address::
>>> from omgeo import Geocoder
>>> g = Geocoder()
>>> result = g.geocode('340 12th St, Philadelphia PA')Take a look at the result::
>>> result
{'candidates': [
<340 S 12th St, Philadelphia, PA, 19107 (-75.161461, 39.94532) EsriWGS>,
<340 N 12th St, Philadelphia, PA, 19107 (-75.158434, 39.958728) EsriWGS>
],
'upstream_response_info': []}Take a closer look at the information in our address Candidate objects::
>>> [c.__dict__ for c in result["candidates"]]
[{'geoservice': 'EsriWGS',
'locator': u'USA.AddressPoint',
'locator_type': u'PointAddress',
'match_addr': u'340 S 12th St, Philadelphia, PA, 19107',
'score': 90.87,
'wkid': 4326,
'x': -75.161461,
'y': 39.94532},
{'geoservice': 'EsriWGS',
'locator': 'interpolation',
'locator_type': u'StreetAddress',
'match_addr': u'340 N 12th St, Philadelphia, PA, 19107',
'score': 90.87,
'wkid': 4326,
'x': -75.158434,
'y': 39.958728}]Some geocoders (EsriWGS and US Census) can return address components in addition to the
full address::>>> [{'geoservice': 'EsriWGS',
'locator': 'interpolation',
'locator_type': u'StreetAddress',
'match_addr': u'340 N 12th St, Phila, Pennsylvania, 19107',
'match_city': u'Phila',
'match_country': u'USA',
'match_postal': u'19107',
'match_region': u'Pennsylvania',
'match_streetaddr': u'340 N 12th St',
'match_subregion': u'',
'score': 90.1,
'wkid': 4326,
'x': -75.158384,
'y': 39.958774}]These are optional; their existence may change depending on the response from the geocoder.
**Testing**
There is a shell script in the root of the repository called *test.dummy.sh*.
Copy it using ``cp test.dummy.sh test.sh``. Edit *test.sh* to include the
API keys that you obtained from the given geocoding service providers. Then, run
the tests using ``./test.sh``.