Location tracking is an organization-wide capability, providing the ability to record where users are and where they have been. Location tracking makes use of a feature service that stores tracked locations as point features in the scalable spatiotemporal big data store. The tracks are secure within the location tracking service: users only see their own tracks, with additional permissions required to view the tracks of others. The tracks can be used for situational awareness and for analysis to answer questions related to where users have been.
Tracker for ArcGIS empowers location tracking, using two apps: the Track Viewer web app and the Tracker for ArcGIS mobile app. The Track Viewer web app enables administrators to create track views, defining who is tracked and who can view those tracks. The Tracker mobile app is optimized for tracking locations in the field, running in background while minimizing the impact on device battery. The mobile app records tracks whether or not there is a data connection, and gives mobile users control of when they are and aren't tracked.
The ArcGIS API for Python makes it easy to manage location tracking capability in an automated, repeatable, and scalable way.
Configuring Location Tracking¶
An authenicated administrator is able to configure location tracking via the
['LocationTrackingError', 'LocationTrackingManager', 'MobileUserManager', 'TrackView', 'TrackViewerManager', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_errors', '_location_tracking', '_track_view']
from arcgis.gis import GIS from arcgis.apps.tracker import TrackView gis = GIS(profile="your_enterprise_portal") location_tracking = gis.admin.location_tracking
Location Tracking has three states
disabled. It's easy to check the status of Location Tracking.
An administrator is able to enable location tracking via the
When location tracking is enabled, a new item gets created representing the
Location Tracking Feature Service. Any mobile user can upload their tracks to this service. This item can be easily accessed using the
Location Tracking Feature Service has two layers. The first layer,
tracks, stores the historical breadcrumbs of each user. The second layer,
last_known_locations, stores the most recent location of each user that is using the Tracker mobile app. These layers can be easily accessed via the
By default, the tracks layer has a retention period of 30 days which means tracks will only be stored for 30 days. An administrator is able to configure the retention period to suit their organization's needs. Let's see how to set the retention period to 6 months.
location_tracking.retention_period = 6 location_tracking.retention_period_units = "MONTHS"
Additionally, if an organization wants to keep their tracks forever, the retention period can be turned off.
location_tracking.retention_period_enabled = False
Creating and Configuring a Track View¶
A core concept of Location Tracking is that certain users in the organization are able to view the tracks of others. This is accomplished by creating a "Track View". A track view is a feature service view created from the Location Tracking Service. It contains a list of Mobile Users representing the users whose tracks will be displayed, and a list of Track Viewers who will have access to see those users tracks. A Track View can easily be created by an administrator.
track_view = location_tracking.create_track_view("Demo Track View")
create_track_view() function returns a
TrackView object. An adminstrator can easily add viewers to the
Similarily an administrator can add mobile users to the Track View
It's easy to see who the track viewers and mobile users are in a
TrackView provides access to both the tracks and last known locations layers so they can easily be used for analysis
Track views can easily be searched for as follows:
items = gis.content.search("typekeywords:'Location Tracking View'")
TrackView object can be created from an item as follows:
track_view2 = TrackView(items) track_view2
<arcgis.apps.tracker._track_view.TrackView at 0x1190c6240>
In order to sign into the Tracker mobile app and upload tracks, users must be provisioned a Tracker for ArcGIS License.
We can see how many licenses are available and how many are assigned
tracker_license = gis.admin.license.get('Tracker for ArcGIS') tracker_license.report
A Tracker for ArcGIS License can be assigned as follows
Similarily a license could be revoked
In order for track viewers to see the tracks of other users in the organization (through a Track View), they must have a role that has the "view location tracks" privilege. The administrator role has this privilege by default. Non-administrators will need to be assigned a custom role that has this privilege. A custom role that can view tracks can be created as shown below.
track_viewer_role = gis.users.roles.create( name='Track Viewer', description="A user that can use the Track Viewer web app to see others tracks", privileges=[ "portal:user:joinGroup", "portal:user:viewTracks", ] )
The custom role can then be assigned to a user.
user = gis.users.get('tracker_demo') user.update_role(track_viewer_role)
This guide explains how an administrator can enable the location tracking capability, and once enabled, how track views can be created and users be added to it. It also explains how an administrator can assign licenses for the Tracker field app to desired users and how custom roles with privileges to view tracks of other users be created.
Feedback on this topic?