skillfed

reverse-geocode

Reverse geocode the given latitude / longitude

reverse-geocode v1.6.6 366.7K downloads/30d#7,203 on PyPI128
Copyleft license lgpl Active released

What it is and what it does

Reverse Geocode is a Python library that maps latitude/longitude coordinates to their nearest known geographic location (country, state, city) using offline lookup rather than a web API. It structures geonames data into a k-d tree for efficient nearest-neighbor searches, making it practical for bulk geocoding tasks where calling an external service would be impractical or undesirable.

The package depends on numpy and scipy for its spatial indexing and numerical operations. Results are returned as dictionaries containing country code, country name, state, city, population, and exact coordinates of the matched location. You can filter results by minimum population to prefer larger cities over nearby smaller ones, though the package notes that point-based lookup gives only a rough approximation compared to polygon-based geographic systems.

Use it for:

  • Batch reverse geocoding thousands of GPS coordinates from a dataset without hitting rate limits or API costs
  • Finding the nearest city to a set of sensor readings or IoT device locations in an offline or air-gapped environment
  • Filtering location results by population threshold to prioritize major cities over small towns in proximity searches
  • Building location-aware analytics on historical coordinate data where real-time API access is not available

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Reverse Geocode converts latitude/longitude coordinates to the nearest known country, state, and city using a k-d tree lookup against geonames data, without requiring a web API.

Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and solves a specific problem (offline bulk reverse geocoding) that web APIs handle poorly. The LGPL license is permissive for non-modifying use. Install it if you need to map coordinates to cities at scale without external dependencies.

Install

reverse-geocode on PyPI

pip

pip install reverse-geocode

uv

uv add reverse-geocode

poetry

poetry add reverse-geocode

Installing reverse-geocode

Before you install

Low friction install with only numpy and scipy as runtime dependencies. The package is actively maintained with a recent commit on 2026-08-01 and has been stable since its first release in 2015.

License in practice

Licensed under LGPL (copyleft), which requires that derivative works and modifications remain under the same license; using this package in proprietary software is permissible if you do not modify it, but modifications must be shared under LGPL terms.

Quickstart

pip install reverse-geocode

import reverse_geocode
melbourne_coord = -37.81, 144.96
result = reverse_geocode.get(melbourne_coord)
print(result)

Verify before relying

  • Whether the package supports batch processing of very large coordinate sets efficiently
  • How frequently the underlying geonames data is updated in the package
  • Accuracy limitations beyond the note that it is point-based rather than polygon-based

Package facts

License lgpl (copyleft)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 2 — numpy, scipy
Maintenance actively maintained — 456 days since the last release
Last repo commit
First released
Downloads 366,666/month — #7,203 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: reverse_geocode-1.6.6-py3-none-any.whl

Environment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3

Tags

reverse geocoding coordinateslat lon to city lookuplatitude longitude to locationnearest city from coordinatesoffline geocodingk-d tree location searchgeonames lookup
geolocationoffline-lookupspatial-indexing

More Information Analysis packages