Operator Type:
Operator Scope of Action:
Operator Purpose:
Operator First Added:
Operator Last Altered:
Function [other Function type actions]
Item [operators of similar scope]
Data manipulation [other Data manipulation operators]
Baseline
As at baseline
drivingTimeTo(item)
drivingTimeTo estimates the driving time between the location specified by the selected (current) note and the location specified by the item path.
Location essentially means explicit $Latitude and $Longitude values for both notes—i.e. start and destination, or data such as $GeocodedAddress that can be examined to retrieve suitable Lat/Long data.
The result is a time interval (interval data type) estimating the approximate driving time, based on traffic conditions prevailing when the action was invoked. For example to find the time to drive from the current location's
if ($MyInterval==0) {
$MyInterval = drivingTimeTo(/places/faves/Swarthmore);
}
There is no result, i.e. estimated driving time is zero (interval of 00:00) if:
- a location for either note cannot be determined
- no route can be found between the two locations (or the locale is not mapped for driving time)
- the internet is not accessible.
Avoid excessive use
Note that this function can be slow and relies on the underlying macOS. Therefore consider using an edict rather than a rule, and avoid recalculating the driving time if you already know it. Code as in the example above should stop unneeded calls. Which such code, if there is a driving time, delete it, and the conditional guard query will allow a fresh call to drivingTimeTo().