How to add a WMS service to ArcGIS Pro using the SDK

Document created by bveldkamp on Sep 13, 2016Last modified by bveldkamp on Sep 13, 2016
Version 4Show Document
  • View in full screen mode

Adding a WMS service to ArcGIS Pro is very simple and straightforward, but you must know which classes to use. Since the documentation is severely lacking in examples, I thought I'd add it here.


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);


Adding a WMTS or a WCS works exactly the same way, just alter the type of the connection variable.


Oh, and before anyone asks, Identify on a WMS only works if a geographical coordinate system is used. Projected does not work at this moment (BUG-000099054).

6 people found this helpful