arcgis.apps.tracker module

The LocationTrackingManager is the main entry point into the Tracker 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 Sharing for an organization. It can be accessed from the gis as location_tracking

Additional information can be found here

Parameter

Description

gis

Required GIS. The GIS to configure location sharing for.

create_track_view(title)

This creates a TrackView.

Parameter

Description

title

Required String. The title of the Track View to create.

Returns

TrackView

disable()

Disables location sharing for the organization.

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

Returns

True if successful, False otherwise

enable(tracks_layer_shards=6, lkl_layer_shards=3, tracks_layer_rolling_index_strategy='Monthly')

Enables location sharing for the organization.

Parameter

Description

tracks_layer_shards

The number of shards to use for the tracks layer. This only applies for ArcGIS Enterprise.

lkl_layer_shards

The number of shards to use for the last known location layer. This only applies for ArcGIS Enterprise.

tracks_layer_rolling_index_strategy

The rolling index strategy for the tracks layer [“Daily”, “Weekly”, “Monthly”, “Yearly”, “Decade”, “Century”] This only applies for ArcGIS Enterprise.

Returns

True if successful, False otherwise

property item

The Location Sharing Item

property last_known_locations_layer

The last known locations FeatureLayer

pause()

Pauses location sharing for the organization.

Returns

True if successful, False otherwise

resume()

Resumes location sharing for the organization after it was paused.

Returns

True if successful, False otherwise

property retention_period

The retention period of the Location Sharing 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 Sharing Tracks Layer

property status

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

property track_lines_layer

The track lines FeatureLayer

property tracks_layer

The tracks FeatureLayer

TrackView

class arcgis.apps.tracker.TrackView(item)

A Track View

Parameter

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 track_lines_layer

The track lines FeatureLayer

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

Parameter

Description

track_view

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

add(viewers)

Adds the specified usernames as Track Viewers

Parameter

Description

viewers

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

delete(viewers)

Parameter

Description

viewers

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

list()

List of all the Track Viewers

Returns

List of strings 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

Parameter

Description

track_view

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

add(users)

Adds the specified usernames as Mobile Users

Parameter

Description

users

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

delete(users)

Parameter

Description

users

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

list()

List of all the Track Viewers

Returns

List of strings representing usernames

property view_definition_query

The View Definition Query of the tracks layer