Adding a WMS service to ArcGIS Pro is very simple and straightforward:
using ArcGIS.Core.CIM;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.Mapping;
// Create a connection to the WMS server
var serverConnection = new CIMInternetServerConnection {URL = "Fill in the URL of the WMS service"};
var connection = new CIMWMSServiceConnection {ServerConnection = serverConnection};
// Add a new layer to the map
await QueuedTask.Run(() =>
{
var layer = LayerFactory.CreateLayer(connection, MapView.Active.Map);
});
But with CIMWCSServiceConnection I can't add a WCS service in ArcGIS Pro, what is wrong in my code:
// Create a connection to the WCS server
var serverConnection = new CIMInternetServerConnection {URL = "Fill in the URL of the WCS service"};
var connection = new CIMWCSServiceConnection {ServerConnection = serverConnection};
// Add a new layer to the map
await QueuedTask.Run(() =>
{
var layer = LayerFactory.CreateLayer(connection, MapView.Active.Map);
});
Thank you in advance.