{"id":6857,"library":"reverse-geocoder","title":"Reverse Geocoder","description":"Reverse Geocoder is a fast, offline Python library designed to convert geographic coordinates (latitude, longitude) into human-readable location data such as city, country, and administrative regions. It improves upon an existing library by utilizing a parallelized K-D tree for enhanced performance, especially for large inputs. The library uses GeoNames data, with a default population filter of >1000, and allows for custom data sources. The current version is 1.5.1, with its last release in September 2016, indicating a maintenance phase rather than active development.","status":"maintenance","version":"1.5.1","language":"en","source_language":"en","source_url":"https://github.com/thampiman/reverse-geocoder","tags":["geocoding","offline","location","python2","python3"],"install":[{"cmd":"pip install reverse-geocoder","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Used for numerical operations and array handling within the K-D tree implementation.","package":"numpy","optional":false},{"reason":"Provides scientific computing tools, likely for spatial data structures and algorithms (e.g., cKDTree).","package":"scipy","optional":false}],"imports":[{"note":"The PyPI package `reverse-geocoder` imports as `reverse_geocoder` (with an underscore). A similarly named but different package, `reverse-geocode` (with a hyphen), has a different API, notably using `reverse_geocode.get()`.","wrong":"import reverse_geocode","symbol":"rg.search","correct":"import reverse_geocoder as rg"}],"quickstart":{"code":"import reverse_geocoder as rg\n\n# List of (latitude, longitude) tuples\ncoordinates = [\n    (51.521458, -0.138850), # London\n    (35.689487, 139.691706), # Tokyo\n    (40.7127837, -74.0059413) # New York City\n]\n\n# Perform reverse geocoding\nresults = rg.search(coordinates)\n\n# Print the results\nfor coord, result in zip(coordinates, results):\n    print(f\"Coordinates: {coord} -> Found: {result['name']}, {result['admin1']}, {result['cc']}\")\n\n# Expected output format (values may vary slightly based on data source)\n# Coordinates: (51.521458, -0.13885) -> Found: London, England, GB\n# Coordinates: (35.689487, 139.691706) -> Found: Tokyo, Tōkyō, JP\n# Coordinates: (40.7127837, -74.0059413) -> Found: New York City, New York, US","lang":"python","description":"This quickstart demonstrates how to import the library and perform reverse geocoding for a list of coordinate pairs. The `search` function returns a list of dictionaries, each containing details like city name, administrative regions, country code, and the nearest latitude/longitude from its internal database."},"warnings":[{"fix":"For new projects, consider more actively maintained alternatives or be prepared to fork and maintain the library yourself. If using, thoroughly test with your specific Python environment and data.","message":"The library's last release (v1.5.1) was in September 2016. It is no longer actively maintained, which may lead to compatibility issues with newer Python versions or other dependencies, and the underlying geodata may be outdated.","severity":"deprecated","affected_versions":"All versions post v1.5.1"},{"fix":"Understand the limitations: this library is suitable for finding general location names (city, country, admin regions) but not for high-precision address lookups. For precise address data, consider online reverse geocoding APIs.","message":"This library performs point-based reverse geocoding, finding the 'nearest' city or town from its GeoNames data. It does not provide precise street-level addresses or polygon-based lookups, offering only a 'rough idea' of the location.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure you are using `reverse-geocoder` v1.2 or newer if working with Python 3. `pip install --upgrade reverse-geocoder` should update to the latest compatible version.","message":"Prior to v1.2 (released March 2015), the library only supported Python 2. While current versions support Python 3, older installations might be Python 2 specific.","severity":"gotcha","affected_versions":"<1.2"},{"fix":"Review the GitHub documentation on custom data sources if you are upgrading from an older version and rely on specific data files or wish to use this new feature.","message":"Version 1.5 introduced support for custom data sources. If upgrading from pre-1.5 versions and expecting specific data behavior, changes in default data loading or API calls for custom sources might be required.","severity":"gotcha","affected_versions":"<1.5"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}