Converts a time offset in seconds to a more natural language
description using hours as the unit, with decimal places to represent
minutes and seconds.Parameters:
offset (int): The time offset in seconds. Can be positive, negative, or zero.
Returns:str: A string representing the offset in hours, such as
“+2.50 hours” or “-3.75 hours”.
A class representing a toolkit for interacting with GoogleMaps API.
This class provides methods for validating addresses, retrieving elevation,
and fetching timezone information using the Google Maps API.
Validates an address via Google Maps API, returns a descriptive
summary. Validates an address using Google Maps API, returning a
summary that includes information on address completion, formatted
address, location coordinates, and metadata types that are true for
the given address.Parameters:
address (Union[str, List[str]]): The address or components to validate. Can be a single string or a list representing different parts.
region_code (str, optional): Country code for regional restriction, helps narrow down results. (default: :obj:None)
locality (str, optional): Restricts validation to a specific locality, e.g., “Mountain View”. (default: :obj:None)
Returns:str: Summary of the address validation results, including
information on address completion, formatted address,
geographical coordinates (latitude and longitude), and metadata
types true for the address.
Retrieves elevation data for a given latitude and longitude.
Uses the Google Maps API to fetch elevation data for the specified
latitude and longitude. It handles exceptions gracefully and returns a
description of the elevation, including its value in meters and the
data resolution.Parameters:
lat (float): The latitude of the location to query.
lng (float): The longitude of the location to query.
Returns:str: A description of the elevation at the specified location(s),
including the elevation in meters and the data resolution. If
elevation data is not available, a message indicating this is
returned.
Retrieves timezone information for a given latitude and longitude.
This function uses the Google Maps Timezone API to fetch timezone
data for the specified latitude and longitude. It returns a natural
language description of the timezone, including the timezone ID, name,
standard time offset, daylight saving time offset, and the total
offset from Coordinated Universal Time (UTC).Parameters:
lat (float): The latitude of the location to query.
lng (float): The longitude of the location to query.
Returns:str: A descriptive string of the timezone information,
including the timezone ID and name, standard time offset,
daylight saving time offset, and total offset from UTC.