Wrapper module for the OpenCage Geocoder API
Maintained. Last release 5 weeks ago, commits in 2 of the last 26 weeks. Weaker on commit activity and security practices.
pip install opencageOpenCage Geocoding Module for Python
A Python module to access the OpenCage Geocoding API.
Build Status / Code Quality / etc
Tutorials
You can find a comprehensive tutorial for using this module on the OpenCage site.
There are two brief video tutorials on YouTube, one covering forward geocoding, one covering reverse geocoding.
Working with AI / Agent Skill
There is an Agent Skill for working with the OpenCage Geocoding API which includes a reference file for developing in Python using this module.
Usage
Supports Python 3.10 or newer. Starting opencage version 3.0 depends on asyncio package.
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' method:
