##### Note:

This functionality is currently only supported in Map Viewer Classic (formerly known as Map Viewer).

The Calculate Motion Statistics tool calculates motion statistics and descriptors for time-enabled points that represent one or more moving entities. The time-enabled point data must include features that represent an instant in time.

## Workflow diagram

## Analysis using GeoAnalytics Tools

Analysis using GeoAnalytics Tools is run using distributed processing across multiple ArcGIS GeoAnalytics Server machines and cores. GeoAnalytics Tools and standard feature analysis tools in ArcGIS Enterprise have different parameters and capabilities. To learn more about these differences, see Feature analysis tool differences.

## Terminology

Term | Description |
---|---|

Geodesic | A line drawn on a sphere. A geodesic line drawn on the globe represents the curvature of the earth's geoid. |

Planar | A straight-line distance as measured on a flat surface (that is, a Cartesian plane). This is also referred to as Euclidean distance. |

Instant | A single moment in time represented by a start time and no end time. |

Segment | A track segment is the path between two sequential observations in a track. |

Track | A sequence of features that are time enabled with time type instant. Features are determined to be in the sequence by a track identifier field and are ordered by time. For example, a city can have a fleet of snow plow trucks that record their location every 10 minutes. The vehicle ID can represent the distinct tracks. |

## Example

A city is monitoring snowplow operations and wants to better understand vehicle movement. It can use the Calculate Motion Statistics tool to determine idle locations and time spent idling, average and maximum speeds over time, total distance covered, and other statistics.

## Usage notes

The Calculate Motion Statistics tool takes a time-enabled point layer as an input and enriches points with motion statistics and measurements. The calculations are based on the input features time and geometry values.

The result of Calculate Motion Statistics is a copy of the input points with a new field for each statistic calculated.

You can specify one or more fields to identify tracks. Tracks are represented by the unique combination of one or more track fields. For example, if the fields flightID and Destination are used as track identifiers, the features ID007, Solden and ID007, Tokoyo would be in two separate tracks, since they have different Destination field values.

Statistics starting with Min-, Max-, Avg-, or Tot- are calculated using the current observation and a number of previous observations defined by the Choose the number of points to be used in calculations parameter. Other statistics are always calculated using only the current and previous observation and do not consider the number of points specified. You can think of this parameter as the number of observations from the current going backward in time. For example, if you choose 5 as the number of points and request the Speed statistic group, the current and the previous four observations are used to calculate MinSpeed, MaxSpeed, and AvgSpeed values at each observation, while Speed values are calculated using only the current and previous observation at each point. The number of points must be greater than one and the default is three.

If there are fewer observations in a track's history than the number of points, statistics starting with Min-, Max-, Avg-, or Tot- are calculated using all observations in the track history.

By default all supported statistics are calculated for each input point if possible. You can choose to include or exclude statistic groups using the Choose one or more motion statistics parameter check box.

The tables below describe the statistics that are calculated for each group. The term track history window refers to all the observations defined by the Choose the number of points to be used in calculations parameter.

- Distance
Statistic Description Distance

Distance traveled from the previous observation to the current.

Total Distance

Sum of distances traveled between observations in the track history window.

Minimum Distance

Minimum of distances traveled between observations in the track history window.

Maximum Distance

Maximum of distances traveled between observations in the track history window.

Average Distance

Average of distances traveled between observations in the track history window.

- Speed
Statistic Description Speed

Speed of travel from the previous observation to the current.

Minimum Speed

Minimum speed between observations in the track history window.

Maximum Speed

Maximum speed between observations in the track history window.

Average Speed

The sum of distances between observations in the track history window divided by the sum of durations between observations in the track history window.

- Acceleration
Statistic Description Acceleration

The difference between the current speed and previous speed divided by the current duration.

Minimum Acceleration

Minimum acceleration calculated in the track history window.

Maximum Acceleration

Maximum acceleration calculated in the track history window.

Average Acceleration

The difference between the current and first speeds in the track history window divided by the sum of durations between observations in the track history window.

- Duration
Statistic Description Duration

The elapsed time since the previous observation.

Total Duration

Sum of durations in the track history window.

Minimum Duration

Minimum duration in the track history window.

Maximum Duration

Maximum duration in the track history window.

Average Duration

Sum of durations in the track history window divided by the number of points.

- Elevation
Statistic Description Elevation

Current elevation of the observation.

Elevation Change

Difference between the current and the previous elevation.

Total Elevation Change

Sum of elevation changes between the points in the track history window. This can be a negative value.

Minimum Elevation

Minimum elevation in the track history window.

Maximum Elevation

Maximum elevation in the track history window.

Average Elevation

Sum of elevations in the track history window divided by the number of points.

- Slope
Statistic Description Slope

Ratio of elevation change to distance between the current and previous observations.

Minimum Slope

Minimum slope in the track history window.

Maximum Slope

Maximum slope in the track history window.

Average Slope

Sum of slopes in the track history window divided by the number of points.

- Idle
Statistic Description Idling

True if the distance between the current observation and the previous is less than the Idle Distance Tolerance value, and the duration between the current observation and the previous is at least the Idle Time Tolerance value. False if one or both of those conditions are not met.

Total Idle Time

Sum of durations in the track history window that meet idling criteria.

Percentage Idle Time

Percentage of time for which idling was detected.

- Bearing
Statistic Description Bearing

Angle of travel from the previous to the current observation.

Statistics are not calculated for the first feature in each track. Statistics in the Acceleration group are not calculated for the first two features in each track.

The result values are in the units specified by the Distance Unit, Duration Unit, Speed Unit, Acceleration Unit, and Elevation Unit parameters. The defaults are meters, seconds, meters per second (m/s), and meters per second squared (m/s²).

There are two distance methods to choose from: planar and geodesic. Geodesic is the default. The planar method measures distances using an Euclidean plane and does not calculate statistics across the date line. When you use the geodesic method to calculate distance and the spatial reference can be panned, calculations cross the date line when appropriate.

Applying a time boundary segments tracks at a defined interval. For example, if you set the time boundary to be 1 day, starting at 9:00 a.m. on January 1, 1990, each track is truncated at 9:00 a.m. for every day. This split is a fast way to accelerate computing time, as it quickly creates smaller tracks for analysis. If splitting by a recurring time boundary makes sense for your analysis, it is recommend for big data processing. Use the Time Interval and Time to align time interval to parameters to specify an optional time boundary split.

If Use current map extent is checked, only the features that are visible within the current map extent will be analyzed. If it's not checked, all input features in the input layer will be analyzed, even if they are outside the current map extent.

## Limitations

Inputs must be point layers with time-enabled features of type instant. Any features that do not have time or geometry are not included in the output layer.

## How Calculate Motion Statistics works

The sections below describe the functionality of the Calculate Motion Statistics tool.

### Equations and calculations

The table below summarizes the statistics calculations for the example above. All calculations are evaluated at point ID p5 and use a track history window of 4. Calculations include Point ID p2, p3, p4 and p5. An observation is considered idling if it has moved less than 32 meters in 1 minute.

Statistic | Formula | Example |
---|---|---|

Distance | 35 m | |

Total Distance | 80 + 30 + 35 = 145 m | |

Speed | Distance / Duration | 35 / 60 = 0.58 m/s |

Average Speed | Total Distance / Total Duration | 145 / 180 m/s |

Acceleration | (0.58 – 0.5) / 60 = 0.001 m/s2 | |

Average Acceleration | (Speed (last) – Speed (first)) / Total Duration | (0.58 – 1.33) / 60 = -0.01 m/s2 |

Duration | 60 s | |

Total Duration | 60 + 60 + 60 = 180 s | |

Elevation | 5 m | |

Elevation Change | 5 – 4 = 1 m | |

Total Elevation Change | 5 – 0 = 5 m | |

Slope | Elevation Change / Distance | 1 / 35 |

Average Slope | Total Elevation Change / Total Distance | 5 / 145 |

Idling | False | |

Total Idle Time | 60 seconds | |

Percentage Idle Time | 1 / 3 | |

Bearing | 0 |

## ArcGIS API for Python example

The Calculate Motion Statistics tool is available through ArcGIS API for Python.

This example calculates distance and idle statistics for delivery trucks.

```
# Import the required ArcGIS API for Python modules
import arcgis
from arcgis.gis import GIS
# Connect to your ArcGIS Enterprise portal and confirm that GeoAnalytics is supported
portal = GIS("https://myportal.domain.com/portal", "gis_publisher", "my_password")
if not portal.geoanalytics.is_supported():
print("Quitting, GeoAnalytics is not supported")
exit(1)
# Search for and list the big data file shares in your portal
search_result = portal.content.search("", "Big Data File Share")
# Look through the search results for the big data file share of interest
bd_layer = next(x for x in search_result if x.title == "bigDataFileShares_TruckingGPSPoints")
# Run the Calculate Motion Statistics tool
result = arcgis.geoanalytics.data_enrichment.calculate_motion_statistics(input_layer = bd_layer,
track_fields = "truckID",
track_history_window = 4,
motion_statistics="Distance,Idle", dist_method="Geodesic",
idle_tol_dist="500",
idle_tol_unit="Meters",
idle_time_tol="30",
idle_time_tol_unit="Minutes",
time_boundary_split="1",
split_unit="Days",
time_bound_ref="655213515000",
distance_unit="Feet",
duration_unit="Seconds",
output_name = "CMS_results")
# Visualize the results if you are running Python in a Jupyter Notebook
processed_map = portal.map()
processed_map.add_layer(result)
processed_map
```

## Similar tools

Use Calculate Motion Statistics to calculate descriptors such as speed, acceleration, bearing, and more for time-enabled point features representing moving entities. Other tools may be useful in solving similar but slightly different problems.

### Map Viewer Classic analysis tools

If you are trying to join attributes from a multi-variable grid to a point layer, use the Enrich From Multi-Variable Grid tool.

### ArcGIS Pro analysis tools

The Calculate Motion Statistics tool is also available in ArcGIS Pro.

To run the tool from ArcGIS Pro, your project's active portal must be running ArcGIS Enterprise 10.9 or later. At 10.9, you must sign in to the portal using an account with privileges to perform spatial analysis in the portal.

Calculate Motion Statistics performs a similar function to the Classify Movement Events tool in ArcGIS Pro.