Create a custom dynamic entity data source and display it using a dynamic entity layer.
Developers can create a custom DynamicEntityDataSource
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 a custom DynamicEntityDataSource
can be used to connect to peer-to-peer feeds in order to visualize real-time location tracks from teammates in the field.
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.
Configure the custom data source:
- Create a custom data source implementation of a
DynamicEntityDataSource
. - Override
OnLoadAsync()
to specify theDynamicEntityDataSourceInfo
for a given unique entity ID field and a list ofField
objects matching the fields in the data source. - Override
OnConnectAsync()
to begin processing observations from the custom data source. - Loop through the observations and deserialize each observation into a
MapPoint
object and aDictionary<string, object>
containing the attributes. - Use
DynamicEntityDataSource.AddObservation(mapPoint, attributes)
to add each observation to the custom data source.
Configure the map view:
- Create a
DynamicEntityLayer
using the custom data source implementation. - Update values in the layer's
TrackDisplayProperties
to customize the layer's appearance. - Set up the layer's
LabelDefinitions
to display labels for each dynamic entity. - Configure a
GeoViewTapped
event handler on theMapView
to select a dynamic entity and display the entity's attributes in a callout.
- DynamicEntity
- DynamicEntityDataSource
- DynamicEntityLayer
- LabelDefinition
- TrackDisplayProperties
This sample uses a .json file containing observations of marine vessels in the Pacific North West hosted on ArcGIS Online.
In this sample, we iterate through features in a GeoJSON file to mimic messages coming from a real-time feed. You can create a custom dyamic entity data source to process any data that contains observations which can be translated into MapPoint
objects with associated Dictionary<string, object>
attributes.
data, dynamic, entity, label, labeling, live, real-time, stream, track