(Added at v1.2)
Use the Stream widget to visualize and control real-time data feeds from streaming feature layers. You can also apply spatial and attribute filters to limit what data is sent to the layer.
In addition to the Stream widget, the Layer List, Legend, Attribute Table, and Print widgets also work with stream layers. Since certain attributes of stream layers are dynamically updated, the attribute table only displays the attributes with a snapshot of stream layers when it opens.
Streaming feature layers connect to an ArcGIS server stream service using HTML5 WebSockets. WebSockets are a new feature of HTML5. Most modern browsers support WebSockets. For more information about WebSockets and to test if a browser supports WebSockets, visit WebSocket.org.
ArcGIS GeoEvent Server is required to publish stream services.
Configure the Stream widget
The Stream widget reads stream layers in the map and lists them in the stream layers table.
This widget can be set to open automatically when an app starts. Hover over the widget and click the Do not open this widget when the app starts button to change the setting to Open this widget automatically when the app starts. (For widgets that you need to add to the app first, you can turn on this option after configuring the widget.)
- Hover over the widget and click the Configure this widget button to open the configuration window.
If you need to add the widget to the app first, click a widget placeholder on the Widget tab. In the Choose Widget window that opens, select the widget and click OK.
- Set the title for the widget, and optionally click Change widget icon if you want to replace the default icon for this widget.
A file explorer window allows you to browse to a local image file to use it as the widget icon.
- All of the stream layers in the map are listed in the stream layers table. Select the layer you want to configure.
- Under Stream Controls, check or uncheck the following options to control the streaming capabilities:
- Enable Stop streaming or Start streaming option
- Enable Clear previous observations option
- Enable Draw previous observations option (This is disabled if the Draw previous observations property is not set in the layer.)
- To apply spatial filters, you have the following two options:
- Limit observations in the current map area
- Limit observations in the user-defined area—Only the rectangle is available for drawing on the map. Click the symbol icon next to the rectangle to define its color, transparency, outline color, and width.
- Check Enable Attribute filter to open the Configure Stream Attribute Filter window.
- Click Add Filter and change the filter name in the Filter Name text box.
- Click Add a filter expression, select a query field, select an expression, and provide a value in the text box.
- Optionally, check Ask for values. When this option is checked, your input value is the default query value, and you have the choice of providing a new value to overwrite the default value at run time.
- You also have the option to use Add an expression set, which allows you to define and apply two filters to a single query. Depending on whether the All or Any option is selected for whether the expressions in this set are true, either features meeting all the expressions or features meeting any of the expressions in the set display on the map.
- Repeat the steps above to add other filters.
- Click OK to close the window.
- To modify the existing attribute filters, click the small edit button to open the Configure Stream Attribute Filter window.
- Repeat step 2–6 to configure other stream layers in the table.
- Click OK to close the configuration window for the widget.
Use the Stream widget
- Click the widget button in your application to open the widget panel.
- Choose a stream layer from the drop-down list if there is more than one layer. In this case, LABus is selected.
- Click Stop Streaming to stop all the data feeds, or click Start Streaming to display real-time data.
- Optionally, click Clear previous observations to clear all the existing features on the map.
- Change the numbers of previous observations you want to draw on the map if available. By default, it shows the same number defined in the map.
- Check the Use spatial filter to limit observations option, and select Limit observations by drawing on the map.
- Click the rectangle and draw it on the map.
Only the features within or intersecting the rectangle on the map show. You can also check a different option to limit observations to the current map extent.
- Check the Use attribute filter to limit observations option, and select the attribute filter you defined.
Only the features meeting the requirement show on the map.
- You can apply spatial and attribute filters together to limit features on the map if needed.