BulkLayerCreationParams Class
Represents an object to initialize and create multiple layers with pre-defined properties.
Create mutliple layers with BulkLayerCreationParams
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 uris = new List<Uri>() { uriShp, uriSde, uri }; ;
// set the index and visibility
var blkParams = new BulkLayerCreationParams(uris);
blkParams.MapMemberPosition = MapMemberPosition.Index;
blkParams.MapMemberIndex = 2;
blkParams.IsVisible = false;
var layers = LayerFactory.Instance.CreateLayers(blkParams, MapView.Active.Map);
}
Add a GeoPackage to the Map
string pathToGeoPackage = @"C:\Data\Geopackage\flooding.gpkg";
//Create lists to hold the URIs of the layers and tables in the geopackage
var layerUris = new List<Uri>();
var tableUris = new List<Uri>();
//Create an item from the geopackage
var item = ItemFactory.Instance.Create(pathToGeoPackage, ItemFactory.ItemType.PathItem);
var children = item.GetItems();
//Collect the table and spatial data in the geopackage
foreach (var child in children)
{
var childPath = child.Path;
if (child.TypeID == "sqlite_table")
tableUris.Add(new Uri(childPath));
else
layerUris.Add(new Uri(childPath));
}
//Add the spatial data in the geopackage using the BulkLayerCreationParams
if (layerUris.Count > 0)
{
BulkLayerCreationParams bulklcp = new BulkLayerCreationParams(layerUris);
LayerFactory.Instance.CreateLayers(bulklcp, MapView.Active.Map);
}
// add the tables separately
foreach (var tableUri in tableUris)
{
StandaloneTableFactory.Instance.CreateStandaloneTable(tableUri, MapView.Active.Map);
}
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3.4 or higher.