Public Function New( _ ByVal dataConnection As CIMDataConnection _ )
public LayerCreationParams( CIMDataConnection dataConnection )
Parameters
- dataConnection
- A ArcGIS.Core.CIM.CIMDataConnection object.
Public Function New( _ ByVal dataConnection As CIMDataConnection _ )
public LayerCreationParams( CIMDataConnection dataConnection )
{
// Create a connection to the WMS server
var serverConnection = new CIMInternetServerConnection { URL = "URL of the WMS service" };
var connection = new CIMWMSServiceConnection { ServerConnection = serverConnection };
// Add a new layer to the map
var layerParams = new LayerCreationParams(connection);
//Note: Needs QueuedTask to run
var layerCreated = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParams, MapView.Active.Map);
}
{
CIMStandardDataConnection cIMStandardDataConnection = new CIMStandardDataConnection()
{
WorkspaceConnectionString = @"SWAPXY=TRUE;SWAPXYFILTER=FALSE;URL=http://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WFSServer;VERSION=2.0.0",
WorkspaceFactory = WorkspaceFactory.WFS,
Dataset = "Continent",
DatasetType = esriDatasetType.esriDTFeatureClass
};
// Add a new layer to the map
var layerPamsDC = new LayerCreationParams(cIMStandardDataConnection);
//Note: Needs QueuedTask to run
Layer layerCreated = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerPamsDC, MapView.Active.Map);
}
{
// Create a connection to the WMS server
var serverConnection = new CIMProjectServerConnection
{
URL = "URL of the WMTS service.xml",
ServerType = ServerType.WMTS,
};
var service_connection = new CIMWMTSServiceConnection
{
ServerConnection = serverConnection,
LayerName = "AdminBoundaries", // Specify the layer name you want to add
};
// Add a new layer to the map
var layerParams = new LayerCreationParams(service_connection);
layerParams.MapMemberPosition = MapMemberPosition.AddToBottom;
//Note: Needs QueuedTask to run
var layerCreated = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParams, map);
}
{
//This workflow would work for
var agsFilePath = @"C:\Data\ServerConnectionFiles\AcmeSampleService.ags";
//ServerConnectionProjectItem supports .ags, .wms, .wmts, .wfs, and .wcs files
var server_conn_item = ItemFactory.Instance.Create(agsFilePath)
as ArcGIS.Desktop.Catalog.ServerConnectionProjectItem;
//Get the server connection - passwords are never returned
var serverConnection = server_conn_item.ServerConnection as CIMProjectServerConnection;
//Add to an AGS service connection
var service_connection = new CIMAGSServiceConnection()
{
URL = "URL to the AGS _service_ on the AGS _server_",
ServerConnection = serverConnection
};
// Add a new layer to the map
var layerParams = new LayerCreationParams(service_connection);
layerParams.MapMemberPosition = MapMemberPosition.AddToBottom;
//Note: Needs QueuedTask to run
var layerCreated = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParams, map);
}
{
Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri(@"C:\Connections\mySDE.sde")));
CIMSqlQueryDataConnection sqldc = new CIMSqlQueryDataConnection()
{
WorkspaceConnectionString = geodatabase.GetConnectionString(),
GeometryType = esriGeometryType.esriGeometryPolygon,
OIDFields = "OBJECTID",
Srid = "102008",
SqlQuery = "select * from MySDE.dbo.STATES",
Dataset = "States"
};
var lcp = new LayerCreationParams(sqldc)
{
Name = "States"
};
//Note: Needs QueuedTask to run
FeatureLayer flyr = LayerFactory.Instance.CreateLayer<FeatureLayer>(lcp, map);
}
{
// Note: call within QueuedTask.Run()
{
//Create with initial visibility set to false. Add to current scene
var createparams = new LayerCreationParams(new Uri(sceneLayerUrl, UriKind.Absolute))
{
IsVisible = false
};
//cast to specific type of scene layer being created - in this case FeatureSceneLayer
var sceneLayer = LayerFactory.Instance.CreateLayer<Layer>(
createparams, MapView.Active.Map) as FeatureSceneLayer;
//or...specify the cast directly
var sceneLayer2 = LayerFactory.Instance.CreateLayer<FeatureSceneLayer>(
createparams, MapView.Active.Map);
//ditto for BuildingSceneLayer, PointCloudSceneLayer, IntegratedMeshSceneLayer
//...
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)