Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Need help adding a WMTSLayer from service.

$
0
0
Hi guys.

I may be way off base here but I'm trying to add a layer from a WMTS connection. I'm using the .Net SDK (C#).

So far I can connect to the Server using IWMTSConnection and then create a WMTSLayer with WMTSConnection() but I can only ever use the first WMTSLayer as an ILayer. I can iterate over the whole structure and pull layer descriptions using IWMTSServiceDescription with IWMTSLayerDescription. But Im at a loss creating a connection where I can use a specific LayerName/Identifier.

Is there a way to either specify the LayerName perhaps when creating the IWMTSConnection or creating the WMTSLayer, that will allow me access other WMTSLayers?

Heres a cut down version of what I currently have:

Code:

    IWMTSLayer wmtsLayer = new WMTSLayerClass();
    IDataLayer dLayer = new WMTSLayerClass();
 
    IPropertySet propSet = new PropertySetClass();
    propSet.SetProperty("URL", "http://localhost/erdas-iws/ogc/wmts/?Service=WMTS&Request=GetCapabilities");

    IWMTSConnectionFactory wmtsConnFactory = new WMTSConnectionFactoryClass();
    IWMTSConnection wmtsConnection = wmtsConnFactory.Open(propSet, 0, null);

    ESRI.ArcGIS.GISClient.IWMTSServiceDescription wmtsServiceDescription = wmtsConnection as IWMTSServiceDescription;
    wmtsLayer.WMTSConnection(wmtsConnection);
               
    for (int i = 0; i < wmtsServiceDescription.LayerDescriptionCount; i++)
    {
          IWMTSLayerDescription layerDescription = wmtsServiceDescription.get_LayerDescription(i);
          if (layerDescription.Identifier.Equals(Wmts_Name, StringComparison.InvariantCultureIgnoreCase))
          {
              //We have a match
              //Maybe need something here to open the correct WMTSLayer?
          }
    }

    if (wmtsLayer != null)
    {
          IMxDocument mxDocument = (IMxDocument)mxApp.Document;
          mxDocument.FocusMap.AddLayer((ILayer)wmtsLayer);
          return true;
    }

Any help on this is greatly appreciate.

Thanks.

Viewing all articles
Browse latest Browse all 1374

Trending Articles