arcgis.apps.tracker module

The LocationTrackingManager is the main entry point into the Workforce module. It can be used as shown in the following code example.

# Access the location tracking manager and check the status

import arcgis
gis = arcgis.gis.GIS("https://arcgis.com", "<username>", "<password>")
print(gis.admin.location_tracking.status)

LocationTrackingManager

class arcgis.apps.tracker.LocationTrackingManager(gis)

This manages Location Tracking for an organization. It can be accessed from the gis as location_tracking

Additional information can be found here: https://doc.arcgis.com/en/tracker/help/configure-location-tracking.htm

Argument

Description

gis

Required GIS. The GIS to configure location tracking for.

create_track_view(title)

This creates a TrackView.

Argument

Description

title

Required String The title of the Track View to create.

Returns

TrackView

disable()

Disables location tracking for the organization.

THIS WILL DELETE ALL LOCATION TRACKING VIEWS, SERVICES, AND DATA.

Returns

True if successful, False otherwise

enable()

Enables location tracking for the organization.

Returns

True if successful, False otherwise

property item

The Location Tracking Item

property last_known_locations_layer

The last known locations FeatureLayer

pause()

Pauses location tracking for the organization.

Returns

True if successful, False otherwise

resume()

Resumes location tracking for the organization after it was paused.

Returns

True if successful, False otherwise

property retention_period

The retention period of the Location Tracking Tracks Layer. This is a positive integer whose units are defined by retention_period_units

property retention_period_enabled

A boolean indicating if the retention period is enabled

property retention_period_units

The retention period units (“HOURS”, “DAYS”, “MONTHS”, “YEARS”) of the Location Tracking Tracks Layer

property status

The status of location tracking (“disabled”, “paused”, “enabled”)

property tracks_layer

The tracks FeatureLayer

TrackView

class arcgis.apps.tracker.TrackView(item)

A Track View

Argument

Description

item

Required Item. The item that represents the Track View.

# Get a Track View and list mobile users.

import arcgis
gis = arcgis.gis.GIS("https://arcgis.com", "<username>", "<password>")
item = gis.content.get("<item-id>")
track_view = arcgis.apps.tracker.TrackView(item)
mobile_users = track_view.mobile_users.list()
delete()

Deletes the Track View, including the group and view service.

property group

The group that contains the Track Viewers and Layers

property item

The Track View Item

property last_known_locations_layer

The last known locations FeatureLayer

property mobile_users

The MobileUserManager for the Track View

property tracks_layer

The tracks FeatureLayer

property viewers

The TrackViewerManager for the Track View

TrackViewerManager

class arcgis.apps.tracker.TrackViewerManager(track_view)

A class that manages the Track Viewers in the Track View.

It can be accessed from the TrackView as viewers

Argument

Description

track_view

Required TrackView. The Track View to configure Track Viewers for.

add(viewers)

Adds the specified usernames as Track Viewers

Argument

Description

viewers

Required List of String or arcgis.gis.User. The list of usernames/users to add as Track Viewers.

delete(viewers)

Argument

Description

viewers

Required List of String or arcgis.gis.User. The list of usernames/users to remove as Track Viewers.

list()

Lists all of the Track Viewers

Returns

List of String representing usernames

MobileUserManager

class arcgis.apps.tracker.MobileUserManager(track_view)

A class that manages the Mobile Users in the Track View.

It can be accessed from the TrackView as mobile_users

Argument

Description

track_view

Required TrackView. The Track View to configure Mobile Users for.

add(users)

Adds the specified usernames as Mobile Users

Argument

Description

users

Required List of String or arcgis.gis.User. The list of usernames/users to add as Mobile Users

delete(users)

Argument

Description

users

Required List of String or arcgis.gis.User. The list of usernames/users to remove as Mobile Users.

list()

Lists all of the Track Viewers

Returns

List of String representing usernames

property view_definition_query

The View Definition Query of the tracks layer