Stubmation
Travel Distance and Time
Calculates the driving distance and travel time between two locations. Useful for delivery scheduling, dispatch planning, and route based workflows.
Uses
A scenario for this could be:
- You have a start and end address and need to know how far apart they are and how long the drive takes
- You know what time a driver must arrive and need to work out when they should leave
- You know what time a driver leaves and need to work out when they will arrive
- You have coordinates instead of addresses and want a single workflow to handle both
This stubmation supports all of those patterns.
Basic Usage
Use this when you have a start and end address and want the distance and travel time between them.
Flow Data Explained
action_params required json object
Contains the start_point and end_point for the trip.
action_params.start_point required json object
The location the trip starts from. Supply either an address or coordinates.
action_params.start_point.address optional string
The full address string to start from. An address takes precedence over coordinates when both are supplied.
Example:
action_params.start_point.coordinates optional json object | string
The start coordinates, used when no address is supplied. See Coordinate Formats for the supported shapes.
action_params.start_point.leave_by optional string
The departure time. When supplied, the workflow calculates the arrival time. This takes precedence over end_point.arrive_by.
Accepts a HH:mm time, which is applied to the current date, or a full ISO timestamp.
Example:
action_params.end_point required json object
The location the trip ends at. Supply either an address or coordinates.
action_params.end_point.address optional string
The full address string to end at. An address takes precedence over coordinates when both are supplied.
Example:
action_params.end_point.coordinates optional json object | string
The end coordinates, used when no address is supplied. See Coordinate Formats for the supported shapes.
action_params.end_point.arrive_by optional string
The required arrival time. When supplied, and start_point.leave_by is not, the workflow calculates the departure time.
Accepts a HH:mm time, which is applied to the current date, or a full ISO timestamp.
Example:
Coordinate Formats
Instead of an address, either point can be supplied with coordinates. The following shapes are supported.
Coordinates as an object
Latitude and longitude keys can be latitude/longitude, lat/lng or y/x.
Coordinates as a comma separated string
A single "latitude,longitude" string.
Result
The task returns the distance and duration for the trip, along with the calculated timing, under payload.stubmation_result.result:
The result object contains the following fields.
distance_meters number
The travel distance in meters.
distance_kilometers number
The travel distance in kilometers, rounded to two decimals.
duration_in_seconds number
The travel time in seconds.
duration_in_minutes number
The travel time in minutes, rounded to two decimals.
duration_in_hours number
The travel time in hours, rounded to two decimals.
leave_by string
The departure timestamp, as an ISO timestamp with timezone offset.
arrive_by string
The arrival timestamp, as an ISO timestamp with timezone offset.
Notes
- Supply an
addressorcoordinatesfor each point. When both are present, theaddressis used. - Supply
leave_byto calculate the arrival time, orarrive_byto calculate the departure time. - When both
leave_byandarrive_byare supplied,leave_bytakes precedence. - When neither is supplied, the current time is used as the departure time.
- Routes are calculated for driving and are traffic aware.