OpenCage Data Geocoding Module for Python
A Python module that uses OpenCage Data's geocoder.
Usage
Install the module:
pip install opencage
Load the module:
from opencage.geocoder import OpenCageGeocode
Create an instance of the geocoder module, passing a valid OpenCage Data Geocoder API key as a parameter to the geocoder modules's constructor:
key = 'your-api-key-here'
geocoder = OpenCageGeocode(key)
Pass a string containing the query or address to be geocoded to the modules's geocode method:
query = "82 Clerkenwell Road, London";
result = geocoder.geocode(query)
You can add additional parameters:
result = geocoder.geocode('London', no_annotations=1, language='es')
Reverse geocoding
Turn a lat/long into an address with the reverse_geocode method:
results = geocoder.reverse_geocode(51.51024, -0.10303)
Exceptions
If anything goes wrong, then an exception will be raised:
InvalidInputErrorfor non-unicode query stringsUnknownErrorif there's some problem with the API (bad results, 500 status code, etc)RateLimitExceededErrorif you go past your rate limit
Metadata
Release files for opencage 1.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opencage-1.1.6.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opencage-1.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / opencage-1.1.6.tar.gz
| Download URL | opencage-1.1.6.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fdb5a9f346ed354e4075d234a359c558c04fdce6df3de803babbce3ae1bb19e3
|
|
BLAKE2b-256 checksum How to use checksums |
34891b5818efcd5882bd4a299466937720541539a61b655f3530f1951b56ec34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
|
Release files / opencage-1.1.6-py3-none-any.whl
| Download URL | opencage-1.1.6-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2c2a84228fedd1dddfca8c819e412f28bb45adb5e5dc6c3d743abf512e26637
|
|
BLAKE2b-256 checksum How to use checksums |
b31db62f20327fc0cc6e61d64748cbf92fefd1beab875090decb54ae190c6048
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
|