Skip to main content

OpenCage CLI

A command-line tool for the OpenCage Geocoding API, for forward and reverse geocoding of CSV files.

Build Status / Code Quality / etc

PyPI version Versions Build Status

Tutorial

See the CLI tutorial on the OpenCage site for a full walk-through.

Installation

Supports Python 3.9 or newer.

pip install opencage-cli

This installs an opencage executable on your PATH. The Python geocoding library it uses (the opencage package on PyPI) is pulled in as a dependency.

Usage

Use opencage forward or opencage reverse:

opencage forward --help

options:
  -h, --help            show this help message and exit
  --api-key API_KEY     Your OpenCage API key
  --input FILENAME      Input file name
  --output FILENAME     Output file name
  --headers             If the first row should be treated as a header row
  --input-columns       Comma-separated list of integers (default '1')
  --add-columns         Comma-separated list of output columns (default 'lat,lng,_type,_category,country_code,country,state,county,_normalized_city,postcode,road,house_number,confidence,formatted')
  --workers             Number of parallel geocoding requests (default 1)
  --timeout             Timeout in seconds (default 10)
  --retries             Number of retries (default 10)
  --api-domain          API domain (default api.opencagedata.com)
  --optional-api-params
                        Extra parameters for each request (e.g. language=fr,no_dedupe=1)
  --unordered           Allow the output lines to be in different order (can be faster)
  --limit               Stop after this number of lines in the input
  --dry-run             Read the input file but no geocoding
  --no-progress         Display no progress bar
  --quiet               No progress bar and no messages
  --overwrite           Delete the output file first if it exists
  --verbose             Display debug information for each request

Set OPENCAGE_GEOCODING_API_KEY to avoid passing your API key on the command line. A supplied --api-key takes precedence over the environment variable.

See examples/addresses.csv for sample input.

Working with AI / Agent Skill

There is an Agent Skill for working with the OpenCage Geocoding API.

Python library

If you want to call the OpenCage API directly from Python rather than via this CLI, install the opencage library — pip install opencage.

This software is copyright OpenCage GmbH. Please see LICENSE.txt

Who is OpenCage GmbH?

We run a worldwide geocoding API and geosearch service based on open data. Learn more about us.

We also run Geomob, a series of regular meetups for location based service creators, where we do our best to highlight geoinnovation. If you like geo stuff, you will probably enjoy the Geomob podcast.

Metadata

Release files for opencage-cli 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opencage-cli 1.1.0
File Size Uploaded Provenance
opencage_cli-1.1.0.tar.gz 13.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for opencage-cli 1.1.0
File Interpreter ABI Platform
opencage_cli-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.3 kB

Release files / opencage_cli-1.1.0.tar.gz

Download URL opencage_cli-1.1.0.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fe630171270b3e25d0c0a14e5209d6a5d7e464b5e9378a61f295c08915603807
BLAKE2b-256 checksum
How to use checksums
03a6838c30db6e0330b20398fce4ec9b84e9ab5e10852d773c05ace8cb4cb98b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / opencage_cli-1.1.0-py3-none-any.whl

Download URL opencage_cli-1.1.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0fc760344cf1b894243557503a100e9ca43ffc9423a10ea39f10df96a175f6cd
BLAKE2b-256 checksum
How to use checksums
702b3431129d78ac775f525b34b67b8c103ad93319c56e8541d4ac9c7dbcaa28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for opencage-cli 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page