Skip to main content

python-geoaddress

Geoaddress is a Python library for address geocoding and reverse geocoding. It provides a unified interface to multiple geocoding providers (Nominatim, Google Maps, Mapbox, etc.) using ProviderKit for provider management.

Installation

pip install geoaddress

For development:

pip install -e .
pip install -e ".[dev,lint,quality,security,test]"

Usage

Geoaddress provides a unified interface to multiple geocoding providers through ProviderKit.

Basic Usage

Search Addresses

from geoaddress import addresses_autocomplete

# Search for addresses using available providers
results = addresses_autocomplete("1600 Amphitheatre Parkway, Mountain View, CA")

# Results include addresses from all available providers
for result in results:
    print(f"{result['text']} - {result['latitude']}, {result['longitude']}")

Reverse Geocoding

from geoaddress import reverse_geocode

# Convert coordinates to address
address = reverse_geocode(37.4224764, -122.0842499)

print(f"Address: {address['text']}")
print(f"City: {address['city']}")
print(f"Country: {address['country']}")

Provider Selection

You can specify which providers to use:

from geoaddress import addresses_autocomplete

# Use only Nominatim provider
results = addresses_autocomplete(
    "Paris, France",
    query_string="nominatim"
)

# Use multiple specific providers
results = addresses_autocomplete(
    "Paris, France",
    query_string="nominatim|photon"
)

Provider Configuration

Providers can be configured via environment variables or configuration files:

# Environment variables (provider-specific prefixes)
# NOMINATIM_USER_AGENT=my-app/1.0
# GOOGLE_MAPS_API_KEY=your-api-key
# MAPBOX_ACCESS_TOKEN=your-token

from geoaddress import addresses_autocomplete

# Providers automatically use environment variables
results = addresses_autocomplete("Paris, France")

Loading Providers from Configuration

from geoaddress import get_address_providers, addresses_autocomplete

# Load providers from JSON configuration
providers = get_address_providers(json="providers.json")

# Use specific providers
results = addresses_autocomplete("Paris, France", providers=providers)

Supported Providers

Free Providers (no API key required)

  • Nominatim: OpenStreetMap-based geocoding
  • Photon: Komoot's OpenStreetMap geocoding service

Paid/API key Providers

  • Google Maps: Google's geocoding API
  • Mapbox: Mapbox Geocoding API
  • LocationIQ: LocationIQ Geocoding API
  • OpenCage: OpenCage Geocoding API
  • Geocode Earth: Geocode Earth API
  • Geoapify: Geoapify Geocoding API
  • Maps.co: Maps.co Geocoding API
  • HERE: HERE Geocoding API

Address Format

All providers return addresses in a standardized format:

{
    "text": "Full formatted address string",
    "reference": "Backend reference ID (place ID)",
    "address_line1": "Street number and name",
    "address_line2": "Building, apartment, floor (optional)",
    "city": "City name",
    "postal_code": "Postal/ZIP code",
    "state": "State/region/province",
    "country": "Country name",
    "country_code": "ISO country code (e.g., FR, US, GB)",
    "latitude": 48.8566,
    "longitude": 2.3522,
    "confidence": 95.0,
    "relevance": 100.0,
    "backend": "Nominatim",
    "backend_name": "nominatim",
    "geoaddress_id": "nominatim-123456"
}

CLI Usage

Geoaddress includes a CLI for command-line usage:

# Search addresses
geoaddress address --query "Paris, France"

# Reverse geocoding
geoaddress reverse --lat 48.8566 --lon 2.3522

# Use specific provider
geoaddress address --query "Paris, France" --backend nominatim

Architecture

Geoaddress uses a provider-based architecture built on ProviderKit:

  • Each geocoding service is implemented as a provider inheriting from GeoaddressProvider
  • GeoaddressProvider extends ProviderBase from ProviderKit
  • Providers are organized in the providers/ directory
  • Common functionality is shared through the base GeoaddressProvider class
  • Provider discovery and management is handled by ProviderKit

Environment Variables

ENVFILE_PATH

The ENVFILE_PATH environment variable allows you to automatically specify the path to a .env file to load when starting services.

Usage:

ENVFILE_PATH=.env.local ./service.py dev install-dev

ENSURE_VIRTUALENV

The ENSURE_VIRTUALENV environment variable allows you to automatically activate the .venv virtual environment if it exists.

Usage:

ENSURE_VIRTUALENV=1 ./service.py quality lint

Provider-Specific Variables

Each provider uses environment variables with specific prefixes:

  • NOMINATIM_USER_AGENT: User agent for Nominatim requests
  • GOOGLE_MAPS_API_KEY: Google Maps API key
  • MAPBOX_ACCESS_TOKEN: Mapbox access token
  • LOCATIONIQ_API_KEY: LocationIQ API key
  • OPENCAGE_API_KEY: OpenCage API key
  • And more...

Use Cases

  • Address search and autocomplete
  • Geocoding addresses to coordinates
  • Reverse geocoding coordinates to addresses
  • Address validation and normalization
  • Multi-provider address lookup with fallback
  • Address data standardization across different geocoding services
  • Integration with mapping and location-based applications

Development

Geoaddress uses clicommands for the CLI. See docs/ for project rules and guidelines.

Metadata

Release files for geoaddress 1.0.3

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

Source distribution (sdist)

Source distribution for geoaddress 1.0.3
File Size Uploaded Provenance
geoaddress-1.0.3.tar.gz 22.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for geoaddress 1.0.3
File Interpreter ABI Platform
geoaddress-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 57.7 kB

Release files / geoaddress-1.0.3.tar.gz

Download URL geoaddress-1.0.3.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
28f72db6312a73d6d660609275b8d6d248cf60ad6cc1b84f821d084d1864cc94
BLAKE2b-256 checksum
How to use checksums
ed024f455735a1fc43bfc9b3b24080ea285bce4a8b7a374917e35d2e8a9e476a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / geoaddress-1.0.3-py3-none-any.whl

Download URL geoaddress-1.0.3-py3-none-any.whl
Size 35.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f954d70b62a2e015490c530df42bfbf1899b963bd28728281e2c24673f2d9cdb
BLAKE2b-256 checksum
How to use checksums
42785193fdc8219baea6897400829298745a02a42a99f4a7d5725023a5c988c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Security for geoaddress 1.0.3

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for geoaddress-1.0.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

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.

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