Skip to content

Googlegeocoding

flowtask.interfaces.GoogleGeocoding

GoogleMapsGeocodingClient

GoogleMapsGeocodingClient(*args, api_key, **kwargs)

Bases: GoogleClient, ABC

Google Maps Geocoding Client for location-based tasks including geocoding, reverse geocoding, distance calculation, and place details.

calculate_distance async

calculate_distance(origin, destination)

Calculate the distance between two locations.

Parameters:

Name Type Description Default
origin str

Starting location (address or coordinates).

required
destination str

Ending location (address or coordinates).

required

Returns:

Name Type Description
dict Dict

Distance and duration between the origin and destination.

geocode_address async

geocode_address(address)

Geocode an address to retrieve latitude and longitude.

Parameters:

Name Type Description Default
address str

The address to geocode.

required

Returns:

Name Type Description
dict Dict

Geocoded location with latitude and longitude.

get_client async

get_client()

Get the Google Maps client, with caching.

get_place_details async

get_place_details(place_id)

Get detailed information about a place by its place ID.

Parameters:

Name Type Description Default
place_id str

The place ID of the location.

required

Returns:

Name Type Description
dict Dict

Detailed information about the place.

reverse_geocode async

reverse_geocode(lat, lng)

Reverse geocode coordinates to retrieve address information.

Parameters:

Name Type Description Default
lat float

Latitude of the location.

required
lng float

Longitude of the location.

required

Returns:

Name Type Description
list List[Dict]

List of addresses for the location.