Google Maps icon

Google Maps

Calculate travel time and distance using Google Maps API

Google Maps

AI-generated

Summary

Calculate travel time and distance between an origin and a destination using the Google Maps Distance Matrix API, specifying the mode of travel.

Inputs

  • Origin (required) — The starting point for calculating travel distance and time, as a textual location (e.g., 'New York, NY').
  • Destination (required) — The end point for the travel distance and time calculation, as a textual location (e.g., 'Boston, MA').
  • Travel Mode — The mode of transportation to calculate travel time and distance for, options include Driving, Walking, Bicycling, or Transit. Defaults to Driving.

Output shape

A single JSON object containing travel details for each input item.

The output JSON includes: origin and destination addresses as resolved by Google Maps, distance and duration both in text form and as numerical values (meters and seconds), and the selected travel mode. If the Google Maps API or route response status is not 'OK', the node throws an error unless 'Continue On Fail' is enabled, in which case error details are output for the corresponding item.

Examples

Example 1: Calculate driving distance and time from New York to Boston.

Set Origin to 'New York, NY', Destination to 'Boston, MA', and Travel Mode to 'Driving'.

Discussion