geopy is a Python library that wraps multiple third-party geocoding APIs so developers can resolve addresses to coordinates and back.
Overview
geopy provides Python classes that call popular geocoding web services from application code. Developers use it to turn street addresses, place names, and landmarks into latitude and longitude pairs, or to reverse geocode coordinates into human-readable addresses.
Each supported service has a geocoder class under geopy.geocoders, typically exposing geocode and reverse methods. Results come back as Location objects with address, latitude, longitude, altitude, and raw provider JSON. The docs stress that geopy itself is not a geocoding provider; quotas, pricing, and data quality depend on whichever remote service you configure.
Bundled examples cover Nominatim, Google Geocoding API v3, and many other providers listed in the documentation. The library also includes distance helpers such as geodesic and great-circle calculations between coordinate pairs.
Installation is via pip. Geocoders run synchronously by default and can use asyncio adapters such as AioHTTPAdapter for async workflows. Service-specific credentials and settings are passed when each geocoder class is constructed.
Key features
- Wrappers for many geocoding providers
- Forward geocode and reverse geocode APIs
- Location objects with raw provider payloads
- Geodesic and great-circle distance helpers
- Optional async adapter support
- getgeocoderforservice factory helper
- functools.partial friendly configuration
- Documented examples for major geocoders
Use cases
- Resolving user-entered addresses in Python apps
- Reverse geocoding GPS coordinates to labels
- Comparing distances between map points
- Switching between geocoding vendors in code
- Async geolocation calls in asyncio services