Description:
- A Python client for several popular geocoding web services.
Resources:
Example 1
Section titled “Example 1”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)Example 2
Section titled “Example 2”Asynchronously geolocate a query to an address and coordinates
from geopy.adapters import AioHTTPAdapterfrom geopy.geocoders import Nominatimimport 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