Reverse Geocode is a Python library (current version 1.6.6) for offline reverse geocoding. It translates latitude/longitude coordinates into the nearest known country, state, and city using a k-d tree structure built from GeoNames data. This is particularly useful for batch processing a large number of coordinates without relying on external web APIs. The project maintains an infrequent release cadence.
pip install reverse-geocodeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to perform reverse geocoding for both single and multiple latitude/longitude coordinates using the `get()` and `search()` functions, respectively. The results include country code, city, latitude, longitude, population, state, and country.
For precise address-level reverse geocoding, consider using external API-based solutions like Geoapify, Geocodio, or Google Maps Platform.
If default data is insufficient, prepare a custom CSV file with the required header and columns, then initialize the geocoder with it using `rg.RGeocoder(stream=io.StringIO(open('custom_source.csv', encoding='utf-8').read()))` (requires importing `io`).If errors related to SciPy arise, try downgrading your SciPy installation to a version below 1.11, e.g., `pip install 'scipy<1.11'`.
Install the library using pip: `pip install reverse-geocode`
For `search()`, pass a list or tuple of coordinate tuples, e.g., `reverse_geocode.search([(lat, lon)])` for one, or `reverse_geocode.search([(lat1, lon1), (lat2, lon2)])` for multiple. For `get()`, pass a single coordinate tuple, e.g., `reverse_geocode.get((lat, lon))`.
No fix is required as this is expected behavior. The message will not appear on subsequent calls unless the `RGeocoder` instance is re-initialized.