“Near Real-Time” Location Tracking for public Web Apps

464
2
02-23-2021 05:03 PM
GlenShepherd
Esri Contributor
4 2 464

The Premise

While ArcGIS Tracker layers ('Tracks' & 'Last Known Location') can be used to live stream location data back to our web portal, this data is protected by additional security settings which prevent them from being shared publicly. Understandably, this is is by-design to protect personal privacy and our location being accidentally shared with the wrong people.

There is however, another method by which we can configure a near-live location stream for public tracking purposes... Consider the following public web app purposes:

  • Tracking a parade along a local street route
  • Locating a school bus on its ring-route
  • Re-tracing your own steps in the field

These are fairly simple and low storage (credit consumption) purposes for which we can use the ArcGIS Online suite to solve.

The workflow in this blog post will combine the following ArcGIS products to configure a public web app for near-live location streaming and tracking:

  • ArcGIS Online
  • ArcGIS QuickCapture (Field Apps Bundle)
  • ArcGIS Web AppBuilder
  • ArcGIS Pro (if necessary, see "Important Considerations" below)

Disclaimer:
ArcGIS QuickCapture will be best suited to streaming this magnitude features from a single device. Attempting to apply this method to multiple users (e.g. a fleet of cars) within a single project, will likely produce performance issues and a less-and-less "live" experience.

 

The Workflow

In this example, we're going to track a theoretical IceCream truck, as it makes its way throughout a neighbourhood.

In ArcGIS Online, we'll want to create a point feature layer - I've named mine "Icecream Truck".

Then, access the QuickCapture Designer via the App Shortcut menu in ArcGIS Online, or using the URL:  https://www.arcgis.com/apps/quickcapture/ 
Creating a new QuickCapture project is easy:

  1. Click "New Project"
  2. Choose "Start from existing layers" and select your point feature layer
  3. Click "Next" and "Create" your project
  4. Please see "Get started with ArcGIS QuickCapture" and "Configure a Project" for more information on the design features of ArcGIS QuickCapture projects
  5. Select the button for your point feature layer, go to the "Data" tab and ensure that "Streaming points" is selected:

    2020-12-30_13-05-12.png

  6. You may also want to go to Settings > General > and enable/disable required accuracy, as well as set a "Distance Threshold" between captured points.
  7. Then "Save" your project
  8. Now, we (or the field worker) will need to download and install the ArcGIS QuickCapture mobile app to our mobile device > log in > select the '+' symbol > Browse Projects > Download the QuickCapture project
  9. Then, go to QuickCapture Settings > Autosend > enable "On" > and select Interval = 'Immediately'

This last step will ensure that streamed point features are synced back to the feature layer in ArcGIS Online as soon as they are captured.

 

Now, back in ArcGIS Online...

  1. Go to Content, then find and Select your point feature layer
  2. Choose to "Create View Layer"
  3. Give the new view layer a Name, Summary, and Tags
  4. Then choose to "Open in Map Viewer"
  5. In your web map, open the drop-down menu for the View Layer > Set View Definition > Define Features

    ViewDef1.png

  6. We can then use the 'Fix Time' attribute (created by QuickCapture) to set an expression to only display the points that have been streamed in the last x amount of time, such as:
    Fix Time - In the last - 5 - minutes

    ViewDef2.png

  7. Furthermore, we want to set our 'Refresh Interval' on this layer, to the lowest possible (every 30 seconds) so that the web map is up to date as often as possible for our web app audience...

    RefreshInt.png

  8. Open the drop-down for the view layer again and choose "Save Layer"
  9. Save the web map and give it a Name, Tags, and Summary... 

 

Now, let's add the new web map to a Web Application...

  1. Go to Content > Create > Web AppBuilder
  2. Choose '2D' > Give the Web App a Name, Tags, and Summary > Click "Create"
  3. Choose a theme
  4. Add your web map
  5. Add widgets which may be of interest:
    1. Bookmarks (from web map)
    2. Filter (you may wish to provide the user with the ability to filter by the 'Fix Time' attribute even further.)
  6. Save the Web Application
  7. In ArcGIS Online > Content > set sharing to "Everyone (Public)" for the following content:
    1. Feature Layer View
    2. Web Map
    3. Web Application

 

Now we (or the field worker) can begin streaming their location from ArcGIS QuickCapture, and their movements can be observed to update every 30 seconds in the web application, with their location over the past 5 minutes trailing behind them!

Example:

Example Output: Points collected in QuickCapture with a 10m Distance Threshold and public Web AppBuilder app with an 'in the last 0.5 minutes' Filter widget enabled, for a car driving through a local neighbourhoodExample Output: Points collected in QuickCapture with a 10m Distance Threshold and public Web AppBuilder app with an 'in the last 0.5 minutes' Filter widget enabled, for a car driving through a local neighbourhood

 

Important Considerations

Streaming and storing features in bulk using ArcGIS QuickCapture is going to have an increasing impact on ArcGIS Online credit consumption over time. We need to remember to batch delete the collected point features once they are no longer relevant to our purpose. This can be done easily in ArcGIS Pro by doing the following:

  1. Open ArcGIS Pro, connect to ArcGIS Online as your 'Active Portal' and sign in.
  2. Go to the 'Catalog' pane, and on the 'Portal' tab, find your streaming feature layer.
  3. Add this layer to the map, right-click it in the 'Contents' pane and open its attribute table.
  4. Ctrl + A will add all features to selection.
  5. Then click the 'Delete' button to remove them.

GlenShepherd_0-1614128202134.png

 

 

 

 

2 Comments
LindsayRaabe_FPCWA
Occasional Contributor II

In the past, I've seen presentations from ESRI and partners (think one was Auckland City Council in New Zealand) that showed the live(?) location of mobile contractors undertaking public works (not public - in house only). I believe this was part of a WorkForce demo. I assume these functions are enabled by the Tracker feature in Field Maps? 

Can ESRI products consume live location data feeds from external applications as well (i.e. a fleet of emergency vehicles)?

GlenShepherd
Esri Contributor

Hi @LindsayRaabe_FPCWA ,

Certainly an interesting point. The "worker" feature layer created from an ArcGIS Workforce project is indeed tracking enabled, whereby the location of a feature (worker) is refreshed every 'x' minutes when the mobile app is in use. And these layers can actually be shared publicly by the data owner. Whereas if we create layers using the ArcGIS Tracker app in ArcGIS Online, these layers can not be shared publicly.

So there might also be a workflow there for re-purposing Workforce feature layers as tracking-enabled public layers.

However, if we're looking to configure web apps/maps with real-time live data feeds (such as fleet tracking), a more robust platform such as ArcGIS Enterprise with a GeoEvent Server site or even utilising the ArcGIS Velocity add-on for ArcGIS Online might be necessary.

About the Author
Esri Australia Technical Support team member based in Melbourne. Working across Enterprise, Desktop and Field Apps. Learning something new every day.
Labels