ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureLayerCreationParams Class / FeatureLayerCreationParams Constructor / FeatureLayerCreationParams Constructor(Uri)
A System.Uri represents the path or url to a dataset or .lyrx or .lpkx file.
Example

In This Topic
    FeatureLayerCreationParams Constructor(Uri)
    In This Topic
    Creates a parameter object with System.Uri.
    Syntax
    Public Function New( _
       ByVal uri As Uri _
    )
    public FeatureLayerCreationParams( 
       Uri uri
    )

    Parameters

    uri
    A System.Uri represents the path or url to a dataset or .lyrx or .lpkx file.
    Remarks

    Some sample paths to:

    A FeatureClass in a FileGeodatabase C:\Data\MyFileGDB.gdb\Census
    A shape file in a folder \\Machine\SharedFolder\MySpatialData.dbf
    A RasterDataset in a FileGeodatabase C:\Data\MyFileGDB.gdb\DEM
    A FeatureClass from a SDE C:\Connections\MySDEConnection.sde\Roads
    An image file in a folder \\Machine\SharedFolder\Imagery.tif
    A .lyrx or .lpkx file \\Machine\SharedFolder\Fires.lyrx
    A map service layer http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer
    A feature layer off a map or feature service http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0

    Example
    Create layer with create-params
    {
        var flyrCreatnParam = new FeatureLayerCreationParams(new Uri(@"c:\data\world.gdb\cities"))
        {
            Name = "World Cities",
            IsVisible = false,
            MinimumScale = 1000000,
            MaximumScale = 5000,
            DefinitionQuery = new DefinitionQuery(whereClause: "Population > 100000", name: "More than 100k"),
            RendererDefinition = new SimpleRendererDefinition()
            {
                SymbolTemplate = SymbolFactory.Instance.ConstructPointSymbol(
           CIMColor.CreateRGBColor(255, 0, 0), 8, SimpleMarkerStyle.Hexagon).MakeSymbolReference()
            }
        };
        //Note: Needs QueuedTask to run
        var featureLayerWithParams = LayerFactory.Instance.CreateLayer<FeatureLayer>(flyrCreatnParam, map);
    }
    Create FeatureLayer and set to not display in Map.
    {
        //The catalog path of the feature layer to add to the map
        var featureClassUriVisibility = new Uri(@"C:\Data\Admin\AdminData.gdb\USA\cities");
        //Define the Feature Layer's parameters.
        var layerParamsVisibility = new FeatureLayerCreationParams(featureClassUriVisibility)
        {
            //Set visibility
            IsVisible = false,
        };
        //Create the layer with the feature layer parameters and add it to the active map
        //Note: Needs QueuedTask to run
        var createdFC = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParamsVisibility, MapView.Active.Map);
    }
    Create FeatureLayer with a Renderer
    {
        //Define a simple renderer to draw the Point US Cities feature class.
        var simpleRender = new SimpleRendererDefinition
        {
            SymbolTemplate = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.RedRGB, 4.0, SimpleMarkerStyle.Circle).MakeSymbolReference()
    
        };
        //The catalog path of the feature layer to add to the map
        var featureClassUri = new Uri(@"C:\Data\Admin\AdminData.gdb\USA\cities");
        //Define the Feature Layer's parameters.
        var layerParams = new FeatureLayerCreationParams(featureClassUri)
        {
            //Set visibility
            IsVisible = true,
            //Set Renderer
            RendererDefinition = simpleRender,
        };
        //Create the layer with the feature layer parameters and add it to the active map
        //Note: Needs QueuedTask to run
        var createdFCWithRenderer = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParams, MapView.Active.Map);
    }
    Create FeatureLayer with a Query Definition
    {
        //The catalog path of the feature layer to add to the map
        var featureClassUriDefinition = new Uri(@"C:\Data\Admin\AdminData.gdb\USA\cities");
        //Define the Feature Layer's parameters.
        var layerParamsQueryDefn = new FeatureLayerCreationParams(featureClassUriDefinition)
        {
            IsVisible = true,
            DefinitionQuery = new DefinitionQuery(whereClause: "STATE_NAME = 'California'", name: "CACities")
        };
        //Note: Needs QueuedTask to run
        //Create the layer with the feature layer parameters and add it to the active map
        var createdFCWithQueryDefn = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParamsQueryDefn, MapView.Active.Map);
    }
    Create Stream Layer with URI
    {
      // Note: call within QueuedTask.Run()
      {
        var url = "https://geoeventsample1.esri.com:6443/arcgis/rest/services/AirportTraffics/StreamServer";
        var createParam = new FeatureLayerCreationParams(new Uri(url))
        {
          IsVisible = false //turned off by default
        };
        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
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also