Arcade is a portable, lightweight, and secure expression language written for use in the ArcGIS platform, and can also be used in some GeoAnalytics Engine tools. Like other expression languages, it can perform mathematical calculations, manipulate text, and evaluate logical statements. It also supports multistatement expressions, variables, and flow control statements. Some GeoAnalytics Engine tools can use Arcade expressions in analysis. In addition to performing mathematical equations, manipulating text and evaluating logical statements, Arcade can leverage the geometry and record values from your input DataFrame. These advanced capabilities enable you to build custom expressions to explore your data. Tool usage and example expressions are outlined below.
Expression formatting
Using Arcade, field names are formatted as $feature["field name"]
or $feature.fieldname
. The first option, $feature["field name"]
, is required when a field name includes a space. All examples
below use this option. All tools use the $feature["field name"]
format except Spatiotemporal Join. For Spatiotemporal Join, use
$target["field name"]
and $join["field name"]
to specify
which input DataFrame will be used.
Learn more about Arcade expressions
Arcade expressions and tools
Arcade expressions are used in GeoAnalytics Engine by the following analysis tools:

Reconstruct Tracks can use Arcade in the following ways:

Buffer expressions—Use buffer expressions to perform a mathematical calculation to set the buffer size. You can perform simple and advanced calculations that can be applied to all records. Buffer calculations are applied to each record.

Split expressions—Use split expressions to specify a condition to split tracks. When records meet the criteria, tracks are split and summarized into different tracks. You can apply simple conditions as well as trackaware conditions. For example, you can split tracks when the speed of the current point is less than two meters per second (
Track
).Current Speed() < 2


Spatiotemporal Join—Use join expressions to specify a condition to select records to include in the join. You can perform simple join conditions (such as
$target["field a"] > $join["field c"])
as well as advanced conditions. The conditions are tested on each record to determine which records are analyzed. Spatiotemporal Join does not support trackaware expressions. 
Calculate Field—Perform simple and advanced calculations that are applied to all records. This calculation is applied to each record. Calculate field supports trackaware expressions when a track field is specified.

Detect Incidents—Determine start and end conditions for incidents. Use start and end expressions to detect incidents. A Detect Incidents condition must always result in true or false. Use a condition to determine whether a record is included in an incident. You can use simple conditions as well as trackaware conditions. The evaluation of conditions is applied to each record.
Example calculations
The following sections outline example calculations using various types of expressions, including mathematical, text, date, trackaware, and more. For more examples, see the Arcade Function Index.
Geometry functions
Arcade expressions can create and evaluate geometry objects. Note, when
you are analyzing multiple geometries they must use the same spatial
reference. For example, use Bearing()
to calculate the direction
your geometries are moving in. The following example uses two records,
point
and point
, and returns a numeric value indicating the
bearing between them.
pointA = Point({ "x":66.23, "y":44.18, "spatialReference": { "wkid":4267 } });
pointB = Point({ "x":62.12, "y":43.22, "spatialReference": { "wkid":4267 } });
Bearing(pointA,pointB)
Returns 256.8528
Learn more about geometry functions available in Arcade
Mathematical operation and functions
Expressions can mathematically process numbers. For example, use
Abs()
to get the positive values for column values representing
change in temperature. The following example uses a column named Temp Change
containing a value of 9
:
Abs($feature["Temp Change"])
Returns 9
Learn more about mathematical operations and functions available in Arcade
Text functions
Arcade expressions can process text. For example, use Find()
and
Lower()
to search a string for a given value. In the following
example, "North"
occurs at position 3 of the input string "146North
:
Find(("north"), Lower("146North
Returns 3
Learn more about text functions available in Arcade
Date functions
Arcade expressions can process dates. In Arcade, month values range from 0 (January) to 11 (December), days from the 1st to the 31st, hours from 0 (12:00 a.m.) to 23 (11:00 p.m.), minutes and seconds from 0 to 59, and milliseconds from 0 to 999.
For example, use Date()
to convert date values stored in
milliseconds from epoch to a formatted date. In the following example
the column My Date
contains a value of 1476987783555
.
Date($features["My Date"])
Returns 20 Oct 2016 11:23:03 AM
Learn more about date functions available in Arcade
Conditional operators
Conditional statements can use the following simple mathematical operators:
Operator  Explanation  Example  Results 

a > b  a is greater than b  10 > 2  True 
a < b  a is less than b  10 < 2  False 
a >= b  a is greater than or equal to b  abs(10) >= 10  True 
a <= b  a is less than or equal to b  abs(10) <= 10  True 
a != b  a is not equal to b  abs(3) != 3  True 
a == b  a is equal to b  abs(5) == 5  True 
<condition1> ║ <condition2>  Condition 1 or condition 2 is met.  (abs(5) == 5) ║ (10 < 2)  True 
<condition1> && <condition2>  Condition 1 and condition 2 are met.  (abs(5) == 5) && (10 < 2)  False 
Logical functions
In addition to simple mathematical expressions, you can use advanced Arcade functions to evaluate conditions or calculate values.
For example, use Iif()
to return specified values when the given
conditions are met. Using the following example, a value of 1
is
returned if cost1
is greater than cost2
. If not, a value of 0
is
returned.
Iif($feature["cost1"] > $feature["cost2"],1, 0)
Learn more about logical functions available in Arcade
Trackaware functions
Detect Incidents, Calculate Field, and Reconstruct Tracks can use trackaware equations in Arcade. In Calculate Field, track equations can be used when the input DataFrame has a single timestamp (instant) and a track field. Use the following expressions to calculate trackaware equations:
Function  Explanation  Example  Result  

TrackStartTime()  Calculate the start time of a track in milliseconds from epoch.  Using a track that starts on January 2, 2017.  1483315200000  
TrackDuration()  Calculate the duration of a track in milliseconds from the start until the current time step.  Using a track that starts on January 2, 2017, and the current time is January 4, 2017.  172800000  
TrackCurrentTime()  Calculate the current time in a track.  Using a feature that occurs on January 3, 2017, at 9:00 a.m.  1483434000000  
TrackIndex  Return the time index of the record being calculated.  Calculating this value on the first record in a track.  0  
TrackFieldWindow(<fieldName>, <startIndex>, <endIndex>)  Return an array of values in the given field for the specified time index. The window function allows you to go forward and backward in time. The expression is evaluated at each record in the track.
 MyField has sequentially ordered values of [10, 20, 30, 40, 50]. The expression is evaluated at each record in the track. Results are returned inclusive of the start record and exclusive of the end record. Example 1: Example 2: Example 3:  Example 1: When evaluated at each record, the table shows the following results:
Example 2: When evaluated at index 2 (value is 30), it returns 10. Example 3: When evaluated at index 2 (value is 30), it returns 50.  
TrackGeometryWindow(<startIndex>, <endIndex>)  Return an array of values representing geometry for the specified time index. The window function allows you to go forward and backward in time. The expression is evaluated at each record in the track.
 MyField has sequentially ordered values of [10, 20, 30, 40, 50]. The expression is evaluated at each record in the track. Results are returned inclusive of the start record, and exclusive of the end record. The input geometries are:
Example 1: Example 2: Example 3: Example 4: Find the X value of the previous point  Example 1: When evaluated at each record, the following table shows the results:
 
TrackWindow(<value1>, <value2>)  Return an array of values representing geometry and all attributes for the specified time index. The window function allows you to go forward and backward in time.
 MyField has sequentially ordered values of [10, 20, 30, 40, 50], in addition to the objectID, globalID, and instant_datetime fields. The input geometries are:
Example 1: Example 2:  Example 1: When evaluated at each record, the table shows the following results:
Example 2: Evaluated at index 2 (value is 30): 2 
Use the following track expressions to calculate distance, speed, and acceleration on tracks. These are similar to calculations used in the Calculate Motion Statistics tool.
All distance calculations are calculated in meters, speed in meters per second, and acceleration in meters per second squared. Distances are measured using geodesic distances.
Function  Explanation 

TrackCurrentDistance()  The sum of the distances travelled between observations from the first to current observation. 
TrackDistanceAt(value)  The sum of the distances travelled between observations from the first to the current observation plus the given value. 
TrackDistanceWindow(value1, value2)  The distances between the first value (inclusive) to the last value (exclusive) in a window about the current observation (0). 
TrackCurrentSpeed()  The speed between the previous observation and the current observation. 
TrackSpeedAt(value1)  The speed at the observation relative to the current observation. For example, at value 2, it's the speed at the observation two observations after the current. 
TrackSpeedWindow(value1, value2)  The speed values between the first value (inclusive) to the last value (exclusive) in a window around the current observation (0). 
TrackCurrentAcceleration()  The acceleration between the previous observation and the current observation. 
TrackAccelerationAt(value1)  The acceleration at the observation relative to the current observation. 
TrackAccelerationWindow(value1, value2)  The acceleration values between the first value (inclusive) to the last value (exclusive) in a window around the current observation (0). 
The example calculations for distance, speed, and acceleration in the table below use examples from the following image.
Function  Example result  

TrackCurrentDistance() 
 
TrackDistanceAt(2) 
 
TrackDistanceWindow(1, 2) 
 
TrackCurrentSpeed() 
 
TrackSpeedAt(2) 
 
TrackSpeedWindow(1, 2) 
 
TrackCurrentAcceleration() 
 
TrackAccelerationAt(2) 
 
TrackAccelerationWindow(1, 2) 
