Display data from an ArcGIS stream service using a dynamic entity layer.

Use case
A stream service is a type of service provided by ArcGIS Velocity and GeoEvent Server that allows clients to receive a stream of data observations via a web socket. ArcGIS Maps SDK allows you to connect to a stream service and manage the information as dynamic entities and display them in a dynamic entity layer. Displaying information from feeds such as a stream service is important in applications like dashboards where users need to visualize and track updates of real-world objects in real-time.
Use ArcGISStreamService to manage the connection to the stream service and purge options to manage how much data is stored and maintained by the application. The dynamic entity layer will display the latest received observation, and you can set track display properties to determine how to display historical information for each dynamic entity. This includes the number of previous observations to show, whether to display track lines in-between previous observations, and setting renderers.
How to use the sample
Use the controls to connect to or disconnect from the stream service, modify display properties in the dynamic entity layer, and purge all observations from the application.
How it works
- Create an
ArcGIStreamServiceusing a stream service URL. - Set an
ArcGISStreamServiceFilteron the stream service to limit the amount of data coming from the server. - Set the
maximumDurationproperty of the stream service’spurgeOptionsto limit the amount of data managed by the application. - Create a
DynamicEntityLayerusing the stream service. - Update values in the layer’s
trackDisplayPropertiesto customize the layer’s appearance. - Add the
DynamicEntityLayerto the map. - Use the
onSingleTapGesturemodifier and callMapViewProxy.identify(on:screenPoint:tolerance:returnPopupsOnly:maximumResults:)to select a dynamic entity and display the entity’s attributes in a callout.
Relevant API
- ArcGISStreamService
- ArcGISStreamServiceFilter
- ConnectionStatus
- DynamicEntity
- DynamicEntityDataSource.PurgeOptions
- DynamicEntityLayer
- TrackDisplayProperties
About the data
This sample uses a stream service that simulates live data coming from snowplows near Sandy, Utah. There are multiple vehicle types and multiple agencies operating the snowplows.
Tags
data, dynamic, entity, live, purge, real-time, service, stream, track