> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Maps

> GoogleMapTools search places, get directions, geocode addresses, and check elevation, timezone, and distance data through the Google Maps API.

**GoogleMapTools** enable an Agent to interact with various Google Maps services for location-based operations including place search, directions, geocoding, and more.

## Prerequisites

The following example requires the `googlemaps` and `google-maps-places` libraries and an API key which can be obtained from the [Google Cloud Console](https://console.cloud.google.com/projectselector2/google/maps-apis/credentials).

```shell theme={null}
uv pip install googlemaps google-maps-places openai
```

```shell theme={null}
export GOOGLE_MAPS_API_KEY=your_api_key_here
```

You'll need to enable the following APIs in your Google Cloud Console:

* Places API
* Directions API
* Geocoding API
* Address Validation API
* Distance Matrix API
* Elevation API
* Time Zone API

## Example

Basic usage of the Google Maps toolkit:

```python theme={null}
from agno.agent import Agent
from agno.tools.google.maps import GoogleMapTools

agent = Agent(tools=[GoogleMapTools()])
agent.print_response("Find coffee shops in San Francisco")
```

For more examples, see the [Google Maps Tools example](https://github.com/agno-agi/agno/blob/main/cookbook/91_tools/google_maps_tools.py).

## Toolkit Params

| Parameter             | Type            | Default | Description                                                                         |
| --------------------- | --------------- | ------- | ----------------------------------------------------------------------------------- |
| `key`                 | `Optional[str]` | `None`  | Optional API key. If not provided, uses GOOGLE\_MAPS\_API\_KEY environment variable |
| `search_places`       | `bool`          | `True`  | Enable the `search_places` tool.                                                    |
| `get_directions`      | `bool`          | `True`  | Enable the `get_directions` tool.                                                   |
| `validate_address`    | `bool`          | `True`  | Enable the `validate_address` tool.                                                 |
| `geocode_address`     | `bool`          | `True`  | Enable the `geocode_address` tool.                                                  |
| `reverse_geocode`     | `bool`          | `True`  | Enable the `reverse_geocode` tool.                                                  |
| `get_distance_matrix` | `bool`          | `True`  | Enable the `get_distance_matrix` tool.                                              |
| `get_elevation`       | `bool`          | `True`  | Enable the `get_elevation` tool.                                                    |
| `get_timezone`        | `bool`          | `True`  | Enable the `get_timezone` tool.                                                     |

## Toolkit Functions

| Function              | Description                                                                                                                                                                                                                                     |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `search_places`       | Search for places using Google Maps Places API. Parameters: `query` (str) for the search query. Returns stringified JSON with place details including name, address, phone, website, rating, and hours.                                         |
| `get_directions`      | Get directions between locations. Parameters: `origin` (str), `destination` (str), optional `mode` (str) for travel mode, optional `departure_time` (datetime), optional `avoid` (List\[str]) for features to avoid. Returns route information. |
| `validate_address`    | Validate an address. Parameters: `address` (str), `region_code` (str, default `"US"`), optional `locality` (str), `enable_usps_cass` (bool, default `False`). Returns address validation results.                                               |
| `geocode_address`     | Convert address to coordinates. Parameters: `address` (str), optional `region` (str). Returns location information with coordinates.                                                                                                            |
| `reverse_geocode`     | Convert coordinates to address. Parameters: `lat` (float), `lng` (float), optional `result_type` and `location_type` (List\[str]). Returns address information.                                                                                 |
| `get_distance_matrix` | Calculate distances between locations. Parameters: `origins` (List\[str]), `destinations` (List\[str]), optional `mode` (str), `departure_time` (datetime), and `avoid` (List\[str]). Returns distance and duration matrix.                     |
| `get_elevation`       | Get elevation for a location. Parameters: `lat` (float), `lng` (float). Returns elevation data.                                                                                                                                                 |
| `get_timezone`        | Get timezone for a location. Parameters: `lat` (float), `lng` (float), optional `timestamp` (datetime). Returns timezone information.                                                                                                           |

You can use `include_tools` or `exclude_tools` to modify the list of tools the agent has access to. Learn more about [selecting tools](/tools/selecting-tools).

## Rate Limits

Google Maps APIs have usage limits and quotas that vary by service and billing plan. Please refer to the [Google Maps Platform pricing](https://cloud.google.com/maps-platform/pricing) for details.

## Developer Resources

* [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/google/maps.py)
