Geocoding Library using ESRI, Bing Maps, and MapQuest geocoders
Project description
OMGeo - Python Edition
python-omgeo is a geocoding abstraction layer written in python. Currently supported geocoders:
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': [<EsriWGS 1054ms>]}
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file python-omgeo-3.0.0.tar.gz
.
File metadata
- Download URL: python-omgeo-3.0.0.tar.gz
- Upload date:
- Size: 33.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 379a0e8233a2db5ee5489be06a025a8bf57a59420e148ce87af406d2ed36a17d |
|
MD5 | 628d11f61ee61b01bd755f06907d52a6 |
|
BLAKE2b-256 | 1cc096c6022aff48f6b9d14cceb552344a77c226dce38533a417a0778e5f6c91 |