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 librarypip install opencage.

Copyright & License

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.

Download files

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

Source Distribution

opencage_cli-1.1.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opencage_cli-1.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file opencage_cli-1.1.0.tar.gz.

File metadata

  • Download URL: opencage_cli-1.1.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for opencage_cli-1.1.0.tar.gz
Algorithm Hash digest
SHA256 fe630171270b3e25d0c0a14e5209d6a5d7e464b5e9378a61f295c08915603807
MD5 28384deee08b6f1c69f24314d8919ab4
BLAKE2b-256 03a6838c30db6e0330b20398fce4ec9b84e9ab5e10852d773c05ace8cb4cb98b

See more details on using hashes here.

File details

Details for the file opencage_cli-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: opencage_cli-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for opencage_cli-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fc760344cf1b894243557503a100e9ca43ffc9423a10ea39f10df96a175f6cd
MD5 f4a74e332055bda8e4b954f27e9d2d8f
BLAKE2b-256 702b3431129d78ac775f525b34b67b8c103ad93319c56e8541d4ac9c7dbcaa28

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.0

2 files

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