ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureLayerCreationParams Class
Members Example

In This Topic
    FeatureLayerCreationParams Class
    In This Topic
    Represents an object to initialize and create a feature layer with pre-defined properties such as renderer, visibility, definition query etc..
    Object Model
    FeatureLayerCreationParams ClassLayer ClassLayer ClassLayer ClassLayer ClassLayer ClassCIMDataConnection ClassDefinitionQuery ClassFeatureClass ClassItem ClassCIMLayerDocument ClassRendererDefinition Class
    Syntax
    public class FeatureLayerCreationParams : LayerCreationParams 
    Public Class FeatureLayerCreationParams 
       Inherits LayerCreationParams
    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,
      // At 2.x - DefinitionFilter = new CIMDefinitionFilter()
      //{
      //  DefinitionExpression = "Population > 100000",
      //  Name = "More than 100k"
      //},
      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()
      }
    };
    
    var featureLayer = 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
    var createdFC = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParamsVisibility, MapView.Active.Map);
    Create FeatureLayer with a Renderer
    //Note: Call within QueuedTask.Run()
    //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
    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.
    //At 2.x - var layerParamsQueryDefn = new FeatureLayerCreationParams(featureClassUriDefinition)
    //{
    //  IsVisible = true,
    //  DefinitionFilter = new CIMDefinitionFilter()
    //  {
    //    Name = "CACities",
    //    DefinitionExpression = "STATE_NAME = 'California'"
    //  }
    //};
    var layerParamsQueryDefn = new FeatureLayerCreationParams(featureClassUriDefinition)
    {
      IsVisible = true,
      DefinitionQuery = new DefinitionQuery(whereClause: "STATE_NAME = 'California'", name: "CACities")
    };
    
    //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);
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Mapping.BaseCreationParams
          ArcGIS.Desktop.Mapping.MapMemberCreationParams
             ArcGIS.Desktop.Mapping.LayerCreationParams
                ArcGIS.Desktop.Mapping.FeatureLayerCreationParams

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also