Googlegeocoding¶
flowtask.components.GoogleGeoCoding
¶
GoogleGeoCoding
¶
Bases: FlowComponent
Google GeoCoding
Overview
This component retrieves geographical coordinates (latitude and longitude) for a given set of addresses using Google Maps Geocoding API. It utilizes asynchronous processing to handle multiple requests concurrently and offers error handling for various scenarios.
.. table:: Properties :widths: auto
+-----------------------+----------+------------------------------------------------------------------------------------------------------+
| Name | Required | Description |
+-----------------------+----------+------------------------------------------------------------------------------------------------------+
| data (pd.DataFrame) | Yes | Pandas DataFrame containing the addresses. Requires a column with the address information. |
+-----------------------+----------+------------------------------------------------------------------------------------------------------+
| columns (list) | Yes | List of column names in the DataFrame that contain the address components (e.g., ["street", "city"]).|
+-----------------------+----------+------------------------------------------------------------------------------------------------------+
Return
The component modifies the input DataFrame by adding new columns named
'latitude', 'longitude', 'formatted_address', 'place_id' and 'zipcode' containing the retrieved
geocoding information for each address. The original DataFrame is returned.
Example:
```yaml
GoogleGeoCoding:
skipError: skip
place_prefix: account_name
use_find_place: true
return_pluscode: true
chunk_size: 50
keywords:
- electronics_store
columns:
- street_address
- city
- state_code
- zipcode
```
find_place
async
¶
find_place(address, place_prefix=None, fields='name,place_id,plus_code,formatted_address,geometry,type', get_plus_code=True)
Searches for a place using the Google Places API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
idx
|
row index |
required | |
row
|
pandas row |
required | |
return_pluscode
|
return the Google +Code |
required | |
place_prefix
|
str
|
adding a prefix to address |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
The Place ID of the first matching result, or None if no results are found. |