ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / StreamLayer Class
Members Example

In This Topic
    StreamLayer Class
    In This Topic
    Represents layer with a collection of real-time features and their visual representation.
    Object Model
    StreamLayer ClassDefinitionQuery ClassCIMRenderer ClassCIMDataConnection ClassTimeExtent ClassCIMBaseLayer ClassGeometry ClassElevationTypeDefinition ClassRealtimeFeatureClass ClassCIMRenderer ClassSelection ClassSpatialReference ClassTable ClassTimeParameters ClassCIMSymbol ClassMap ClassILayerContainer InterfaceEnvelope ClassRowCursor ClassRealtimeCursor ClassSelection ClassDefinitionQuery ClassRealtimeCursor Class

    Stream layer is a type of FeatureLayer.To create a StreamLayer, you must call CreateLayer method of the LayerFactory class, instead of directly using a constructor.

    When you use LayerFactory.CreateLayer<T>, you need to pass in a FeatureLayerCreationParams. You should set UniqueValueRendererDefinition and ClassBreaksRendererDefinition in a FeatureLayerCreationParams only when the source stream service has associated archieved feature service layer. See ArcGIS.Core.Data.Realtime.StreamServiceFeatureClassDefinition.GetArchiveFeatureServiceLayerURL for details. That is because at the creation time a stream layer starts with empty set of features.

    You can call FeatureLayer.CreateRenderer anytime later once you have sufficient features to compute and assign a ArcGIS.Core.CIM.CIMUniqueValueRenderer or ArcGIS.Core.CIM.CIMClassBreaksRenderer to a stream layer.

    Create Stream Layer with URI
    //Must be on the QueuedTask
    var url = "";
    var createParam = new FeatureLayerCreationParams(new Uri(url))
      IsVisible = false //turned off by default
    var streamLayer = LayerFactory.Instance.CreateLayer<StreamLayer>(createParam, map);
    //or use "original" create layer (will be visible by default)
    Uri uri = new Uri(url);
    streamLayer = LayerFactory.Instance.CreateLayer(uri, map) as StreamLayer;
    streamLayer.SetVisibility(false);//turn off
    Create a stream layer with a definition query
    //Must be on the QueuedTask
    var url = "";
    var lyrCreateParam = new FeatureLayerCreationParams(new Uri(url))
      IsVisible = true,
      //At 2.x - DefinitionFilter = new CIMDefinitionFilter()
      //  DefinitionExpression = "RWY = '29L'",
      //  Name = "Runway"
      DefinitionQuery = new DefinitionQuery(whereClause: "RWY = '29L'", name: "Runway")
    var streamLayer = LayerFactory.Instance.CreateLayer<StreamLayer>(lyrCreateParam, map);
    Retrieve the current observation renderer
    //Must be on QueuedTask!
    var renderer = streamLayer.GetRenderer();
    Inheritance Hierarchy



    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also