# 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