maps_matrix_api v0.1.0 MapsMatrixApi

MapsMAtrixApi is a simple interface to Googles Distance Matrix Api

Link to this section Summary

Types

A address that will be transformed and geocoded to latitude and longitude

A latitude and longitude pair in a tuple or comma-separated string format

A tuple with an id of a known place

A specific point, which can be an address, a latitude/longitude coord or a place id tupple

Link to this section Types

Link to this type address()
address() :: String.t()

A address that will be transformed and geocoded to latitude and longitude.

Link to this type coordinate()
coordinate() :: {latitude(), longitude()} | String.t()

A latitude and longitude pair in a tuple or comma-separated string format.

Link to this type latitude()
latitude() :: number()
Link to this type longitude()
longitude() :: number()
Link to this type mode()
mode() :: String.t()
Link to this type options()
options() :: keyword()
Link to this type place_id()
place_id() :: {:place_id, String.t()}

A tuple with an id of a known place.

Link to this type waypoint()
waypoint() :: address() | coordinate() | place_id()

A specific point, which can be an address, a latitude/longitude coord or a place id tupple.

Link to this section Functions

Link to this function data(origin, destination, options \\ [])

Retrives the maps matrix from one point to another.

Args:

  • origin - The coordinates latitude, longitude value, address, or place ID from which the calculation will be executed. If an address is passed the string will be transformed into a latitude, longitude coordinate.

  • destination — The coordinates latitude, longitude value, address, or place ID from which the calculation will be executed. If an address is passed the string will be transformed into a latitude, longitude coordinate.

Options:

  • departure_time — Specifies the desired time of departure. You can specify the time as an integer in seconds since midnight, January 1, 1970 UTC. Alternatively, you can specify a value of now, which sets the departure time to the current time (correct to the nearest second). The departure time may be specified in two cases:

    • For requests where the travel mode is transit: You can optionally specify one of departure_time or arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time).
    • For requests where the travel mode is driving: You can specify the departure_time to receive a route and trip duration (response field: duration_in_traffic) that take traffic conditions into account. This option is only available if the request contains a valid API key, or a valid Google Maps APIs Premium Plan client ID and signature. The departure_time must be set to the current time or some time in the future. It cannot be in the past.
  • units — Specifies the unit system to use displaying results.

Examples

iex> MapsMatrixApi.get()
:world
Link to this function distance(origin, destination, options \\ [])
Link to this function eta(origin, destination, options \\ [])

Retrives the disntace from one point to another.

Args:

  • origin - The coordinates latitude, longitude value, address, or place ID from which the calculation will be executed. If an address is passed the string will be transformed into a latitude, longitude coordinate.

  • destination — The coordinates latitude, longitude value, address, or place ID from which the calculation will be executed. If an address is passed the string will be transformed into a latitude, longitude coordinate.

Options:

  • departure_time — Specifies the desired time of departure. You can specify the time as an integer in seconds since midnight, January 1, 1970 UTC. Alternatively, you can specify a value of now, which sets the departure time to the current time (correct to the nearest second). The departure time may be specified in two cases:

    • For requests where the travel mode is transit: You can optionally specify one of departure_time or arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time).
    • For requests where the travel mode is driving: You can specify the departure_time to receive a route and trip duration (response field: duration_in_traffic) that take traffic conditions into account. This option is only available if the request contains a valid API key, or a valid Google Maps APIs Premium Plan client ID and signature. The departure_time must be set to the current time or some time in the future. It cannot be in the past.
  • units — Specifies the unit system to use displaying results.

Examples

iex> MapsMatrixApi.get()
:world
Link to this function eta_distance(origin, destination, options \\ [])
Link to this function timezone(input, options \\ [])
timezone(coordinate(), options()) :: Response.t()