Select to view content in your preferred language

Applying an ArcGISStreamServiceFilter on a custom DynamicEntityDataSource

553
6
Jump to solution
05-12-2025 12:11 AM
Labels (2)
FatmaAkdemir
Frequent Contributor

I have a custom class inheriting the DynamicEntityDataSource. I want to apply a similar filtering mechanism just like ArcGISStreamServiceFilter but I couldn't find any examples. I wanted to look at ArcGISStreamService class's setFilter() function but I could not find the .cpp implementation.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JamesBallard1
Esri Regular Contributor

@FatmaAkdemir yes that should be possible, but you'd need some additional data structures to keep track of things.

You can get the list of all dynamic entities at any moment with queryDynamicEntitiesAsync and providing '1=1' whereClause on the DynamicEntityQueryParameters, which should return everything.

Then, you can monitor all activity on the dynamicEntityObservationReceived signal to keep track of which ones have reported updated in the previous 10 seconds. Between those two lists, you should be able to call deleteEntityAsync on all entities that would be considered stale by your 10 second threshold.

 

View solution in original post

6 Replies
JamesBallard1
Esri Regular Contributor

Hi @FatmaAkdemir .

We have some examples of custom dynamic entity data sources, take and look and let us know if that helps.

https://github.com/Esri/dynamic-situational-awareness-qt/blob/b22f92be4dc4916f2c6f1d95d64fe7cda27586... 

https://github.com/Esri/arcgis-maps-sdk-samples-qt/tree/main/CppSamples/Layers/AddCustomDynamicEntit... 

I think if you want to match the functionality of ArcGISStreamServiceFilter, you could apply any filter when you process the data and choose whether or not to process it at all, for example here you can filter on any criteria and then simply not call addObservation.

https://github.com/Esri/arcgis-maps-sdk-samples-qt/blob/main/CppSamples/Layers/AddCustomDynamicEntit... 

FatmaAkdemir
Frequent Contributor

Hi @JamesBallard1 ,

Thanks for your reply. The filtering mechanism is defined by the user by clicking on some checkboxes (e.g. speed greater than some value) on runtime. After the user clicks Apply button, I also need to apply that filtering to previously added observations that are being displayed on the map. How would I achieve that?

0 Kudos
JamesBallard1
Esri Regular Contributor

Thanks for the clarification, I will check with our team on this and get back to you.

0 Kudos
JamesBallard1
Esri Regular Contributor

@FatmaAkdemir unfortunately there is no clean way to do this with DynamicEntityDataSource itself as there is with ArcGISStreamService.

Something that is a possible workaround could be something along these lines. Before I even mention it, I need to be clear that this is not perfect, and there will be difficulties getting it right. At best this would only give you the ability to present a frozen snapshot of the data matching your filter criteria and it wouldn't support the live data streaming in.

You could perform a query (via https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-dynamicentitydatasource.html#q...) and then from those results you could create temporary graphics from each entity's attributes and geometry. Then you can hide the DynamicEntityLayer and show your graphics. But again, this is just a snapshot and wouldn't support any additional data streaming in without extra plumbing to keep track of everything being added and constantly updating the graphics. Track rendering would also be lost, so there are major drawbacks to this approach, but it is something if you need to visualize which entities currently meet some filter criteria.

FatmaAkdemir
Frequent Contributor

Thanks for your detailed solution! If there was a way to delete all dynamic entities that did not receive any new observations for 10 seconds I would not need to apply filtering to those previous entities. They would be deleted already by this mechanism. Is there a way to do that?

0 Kudos
JamesBallard1
Esri Regular Contributor

@FatmaAkdemir yes that should be possible, but you'd need some additional data structures to keep track of things.

You can get the list of all dynamic entities at any moment with queryDynamicEntitiesAsync and providing '1=1' whereClause on the DynamicEntityQueryParameters, which should return everything.

Then, you can monitor all activity on the dynamicEntityObservationReceived signal to keep track of which ones have reported updated in the previous 10 seconds. Between those two lists, you should be able to call deleteEntityAsync on all entities that would be considered stale by your 10 second threshold.