Tools for interacting with Google Maps services including place search, directions, geocoding, and more
googlemaps
library and an API key which can be obtained from the Google Cloud Console.
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 places search functionality |
get_directions | bool | True | Enable directions functionality |
validate_address | bool | True | Enable address validation functionality |
geocode_address | bool | True | Enable geocoding functionality |
reverse_geocode | bool | True | Enable reverse geocoding functionality |
get_distance_matrix | bool | True | Enable distance matrix functionality |
get_elevation | bool | True | Enable elevation functionality |
get_timezone | bool | True | Enable timezone functionality |
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 avoid (List[str]) for features to avoid. Returns route information. |
validate_address | Validate an address. Parameters: address (str), optional region_code (str), optional locality (str). 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) 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. |