ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / BulkLayerCreationParams Class / BulkLayerCreationParams Constructor / BulkLayerCreationParams Constructor(IEnumerable<LayerCreationParams>)
An enumeration of LayerCreationParams objects.
Example

In This Topic
    BulkLayerCreationParams Constructor(IEnumerable<LayerCreationParams>)
    In This Topic
    Creates a parameter object with an enumeration of LayerCreationParams. The LayerCreationParams objects must be sourced as all Uris or all CIMDataConnections or all Items. Supplying a combination of these will cause LayerFactory.CreateLayers to throw an ArgumentException.
    Syntax

    Parameters

    layerCreationParams
    An enumeration of LayerCreationParams objects.
    Remarks
    Only the following set of layer creation objects are supported for bulk creation - FeatureLayerCreationParams, CatalogLayerCreationParams, RasterLayerCreationParams, MosaicLayerCreationParams and the base class LayerCreationParams. Including other types will cause an ArgumentException to be thrown from within LayerFactory.CreateLayers.
    Example
    Create multiple layers with BulkLayerCreationParams 2 - invalid
    var uriShp = new Uri(@"c:\data\roads.shp");
    var lcpShp = new FeatureLayerCreationParams(uriShp);
    lcpShp.Name = "Roads";
    lcpShp.IsVisible = false;
    lcpShp.DefinitionQuery = new DefinitionQuery("shpQuery", "OBJECTID > 10");
    
    var lcpItem = new FeatureLayerCreationParams(Item);
    lcpItem.Name = "Census Polygons";
    lcpItem.IsVisible = true;
    
    // list contains a Uri data source and an Item data source
    // LayerFactory.Instance.CreateLayers will throw an ArgumentException
    var lcps = new List<FeatureLayerCreationParams>();
    lcps.Add(lcpShp);
    lcps.Add(lcpItem);
    
    var blkParams = new BulkLayerCreationParams(lcps);
    
    // LayerFactory.Instance.CreateLayers will thrown an ArgumentException
    // because the LayerCreationParams are created using different 
    // types of data sources (1 Uri and 1 Item)
    var layers = LayerFactory.Instance.CreateLayers(blkParams, MapView.Active.Map);
    Create multiple layers with BulkLayerCreationParams 2 - Valid
    var uriShp = new Uri(@"c:\data\roads.shp");
    var uriSde = new Uri(@"c:\MyDataConnections\MySDE.sde\Census");
    var uri = new Uri(@"http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0");
    
    var lcpShp = new FeatureLayerCreationParams(uriShp);
    lcpShp.Name = "Roads";
    lcpShp.IsVisible = false;
    lcpShp.DefinitionQuery = new DefinitionQuery("shpQuery", "OBJECTID > 10");
    
    var lcpSde = new FeatureLayerCreationParams(uriSde);
    lcpSde.Name = "Census Polygons";
    lcpSde.IsVisible = true;
    
    var lcpService = new FeatureLayerCreationParams(uri);
    lcpService.Name = "Shelters";
    lcpService.IsVisible = true;
    // set some renderer here ...
    //lcpService.RendererDefinition = ...
    
    var lcps = new List<FeatureLayerCreationParams>();
    lcps.Add(lcpShp);
    lcps.Add(lcpSde);
    lcps.Add(lcpService);
    
    var blkParams = new BulkLayerCreationParams(lcps);
    // set the positioning on the BulkLayerCreationParams
    blkParams.MapMemberPosition = MapMemberPosition.Index;
    blkParams.MapMemberIndex = 0;
    
    var layers = LayerFactory.Instance.CreateLayers(blkParams, MapView.Active.Map);
    Create multiple layers with BulkLayerCreationParams - Using RollbackBehavior
    var uriShp = new Uri(@"c:\data\roads.shp");
    var uriSde = new Uri(@"c:\MyDataConnections\MySDE.sde\Census");
    var uri = new Uri(@"http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0");
    
    var lcpShp = new FeatureLayerCreationParams(uriShp);
    lcpShp.Name = "Roads";
    lcpShp.IsVisible = false;
    lcpShp.DefinitionQuery = new DefinitionQuery("shpQuery", "OBJECTID > 10");
    
    var lcpSde = new FeatureLayerCreationParams(uriSde);
    lcpSde.Name = "Census Polygons";
    lcpSde.IsVisible = true;
    
    var lcpService = new FeatureLayerCreationParams(uri);
    lcpService.Name = "Shelters";
    lcpService.IsVisible = true;
    // set some renderer here ...
    //lcpService.RendererDefinition = ...
    
    var lcps = new List<FeatureLayerCreationParams>();
    lcps.Add(lcpShp);
    lcps.Add(lcpSde);
    lcps.Add(lcpService);
    
    var blkParams = new BulkLayerCreationParams(lcps);
    // set the positioning on the BulkLayerCreationParams
    blkParams.MapMemberPosition = MapMemberPosition.Index;
    blkParams.MapMemberIndex = 0;
    
    // set the rollback behavior
    // - rollback if one or more layers cannot be created due to an invalid data source
    blkParams.RollbackBehavior = LayerCreationRollbackBehavior.RollbackOnMissingLayers;
    
    var layers = LayerFactory.Instance.CreateLayers(blkParams, MapView.Active.Map);
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.6 or higher.
    See Also