Skip to content

Description:

  • A Python client for several popular geocoding web services.

Resources:

Synchronously geolocate a query to an address and coordinates

from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="demo-notebooks-geopy")
location = geolocator.geocode("175 5th Avenue NYC")
print(location.address)
print((location.latitude, location.longitude))
print(location.raw)

Asynchronously geolocate a query to an address and coordinates

from geopy.adapters import AioHTTPAdapter
from geopy.geocoders import Nominatim
import asyncio
async def async_example():
async with Nominatim(
user_agent="demo-notebooks-geopy",
adapter_factory=AioHTTPAdapter,
) as geolocator:
location = await geolocator.geocode("175 5th Avenue NYC")
print(location.address)
def main():
loop = asyncio.get_event_loop()
loop.run_until_complete(async_example())
loop.close()
main()

ganymede is made by Eugo