Create a custom dynamic entity data source and display it using a dynamic entity layer.

Use case
Developers can create a CustomDynamicEntityDataSource to be able to visualize data from a variety of different feeds as dynamic entities using a DynamicEntityLayer. An example of this is in a mobile situational awareness app, where CustomDynamicEntityDataSource can be used to connect to peer-to-peer feeds in order to visualize real-time location tracks from teammates in the field.
How to use the sample
Run the sample to view the map and the dynamic entity layer displaying the latest observation from the custom data source. Tap on a dynamic entity to view its attributes in a callout.
How it works
- Create the metadata for the data source using
DynamicEntityDataSourceInfofor a given unique entity ID field and an array ofFieldobjects matching the fields in the data source. - Create your custom feed type that conforms to
CustomDynamicEntityFeedwhich will implement the data feed that will asynchronously emitCustomDynamicEntityFeedEvent. - The feed should loop through the observations JSON and deserialize each observation into a
Pointobject and aDictionary<String, Any>containing the attributes. - Use
CustomDynamicEntityFeedEvent.newObservation(geometry:attributes:)to add each event to the feed. - Create a custom data source using
CustomDynamicEntityDataSource.
Relevant API
- CustomDynamicEntityDataSource
- CustomDynamicEntityFeed
- CustomDynamicEntityFeedEvent
- DynamicEntity
- DynamicEntityDataSource
- DynamicEntityLayer
- LabelDefinition
- TrackDisplayProperties
About the data
This sample uses a JSON Lines file containing observations of marine vessels in the Pacific North West hosted on ArcGIS Online.
Tags
data, dynamic, entity, label, labeling, live, real-time, stream, track