Skip to main content

Geocoding Library using ESRI, Google, Bing Maps, US Census, OpenStreetMap, Pelias, 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_omgeo-6.2.2.tar.gz (37.9 kB view details)

Uploaded Source

Built Distribution

python_omgeo-6.2.2-py3-none-any.whl (40.9 kB view details)

Uploaded Python 3

File details

Details for the file python_omgeo-6.2.2.tar.gz.

File metadata

  • Download URL: python_omgeo-6.2.2.tar.gz
  • Upload date:
  • Size: 37.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for python_omgeo-6.2.2.tar.gz
Algorithm Hash digest
SHA256 534771c50dca56a9eb5d1865846d62829022789a096a683935ff6ef0d96044af
MD5 ee670d5e1f67988ddae20b0bd71b1404
BLAKE2b-256 6761d0cd7e019a66176c45c6a25874666359fdca0924aae364790c98c28754cc

See more details on using hashes here.

File details

Details for the file python_omgeo-6.2.2-py3-none-any.whl.

File metadata

  • Download URL: python_omgeo-6.2.2-py3-none-any.whl
  • Upload date:
  • Size: 40.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for python_omgeo-6.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6ade831111b12ac7c865b6510d895ac0c3c384abfed705b5727db357c7879d22
MD5 e27635b936fa8e39785e5db3461f8d20
BLAKE2b-256 21b828c90f066f6d2e32d2b3be06aff212a3633a53e2810d8f00200590b0157a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page