Public Function New( _ ByVal uris As IEnumerable(Of Uri) _ )
public BulkLayerCreationParams( IEnumerable<Uri> uris )
Parameters
- uris
- An enumeration of System.Uri that represent a set of paths or urls to datasets or .lyrx or .lpkx files.
Public Function New( _ ByVal uris As IEnumerable(Of Uri) _ )
public BulkLayerCreationParams( IEnumerable<Uri> uris )
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 |
{
//Uris to the datasets for the layers to be created
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");
// Create a list of URIs to be used for creating multiple layers
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;
// Create multiple layers using the BulkLayerCreationParams
//Note: Needs QueuedTask to run
var layers = LayerFactory.Instance.CreateLayers(blkParams, MapView.Active.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
//Note: Needs QueuedTask to run
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 Home, Pro, Enterprise (64 bit)