Removing stream layer features from a web map

2313
2
12-23-2015 10:33 AM
Highlighted
New Contributor III

@Sharon_Meier posted a question to @Track_Gap_Detector_at on 23-December-2015:

I have a question regarding the Track Gap detector.  I have set up a Track Gap Processor and it is detecting a gap in my input.   I have been writing the output to a stream service and want to only display the track event when it is true.   I've created a webmap and added the stream service to it, and created a filter that says when "gap is true".  I want to display a little red flag when that happens.  That is working fine.  The problem is that my red flag never goes away when gap is false.   Any recommendations on the best way to do something like this?

Your question is not really about how to configure the Track Gap detector. You've successfully got that working and are correctly filtering to send event data to a stream service when a condition "gap is true" is satisfied.

The way I'm reading your question, you want to know how to remove a mapped event from a web map's stream layer once a gap in the expected receipt of event data has been remedied.

The map elements displayed by a stream layer are not what we would call "features" from a traditional feature layer. Since there is no backing feature class there is data record or row we can delete from a table. So there's no way to delete a record, refresh the web map, and see the remaining "features" displayed.

I think the correct way, when using a stream service, of removing unwanted stream layer observations from a web map would be to implement your own JavaScript​​ web application supporting stream layers​​ and manage the stream layer's display based on attributes in the event data you receive from the stream service.

It's a pretty sloppy work around, but you could filter to identify when the Track Gap processor is signaling that data from the feed is again being received (gap = false) and use a Field Calculator to generate a string representation of a point Geometry well out of the way of your operational area, say for example:

'{ "x":-179.995, "y":-79.995, "spatialReference":{"wkid":4326} }'

Then when looking at your map you'd see something like:

Capture.png

A true/complete view of the web map is really more like the illustration below.

(The lost signal icon has just been moved to a location you're not likely to encounter it)

Capture.png

As always, I invite comments from anyone imagining a different approach.  I'm only trying to describe a solution that can be taken using out-of-the-box components.

- RJ

Reply
0 Kudos
2 Replies
Highlighted
New Contributor III

RJ, as always, thanks for the input.   I will work with this info and see what I can come up with.   The work around is close to what I've been experimenting with. 

Reply
0 Kudos
Highlighted
New Contributor

Have you tried setting visible to false on the graphic by using setAttribute method in the StreamLayer API?

Reply
0 Kudos