How to get informations from an WMTSLayer

5573
7
08-28-2014 12:46 AM
ArminMueller
New Contributor III

I have an WMTSLayer in ArcObjects. I want to get informations from this object. I found IWMTSLayerDescription and IWMTSServiceDescription as interfaces to get the informations i need. But i do not found any possibilty how to use these Interfaces.

Is there any out there who has a solution?

Greetings

Armin

Tags (1)
0 Kudos
7 Replies
MatthiasSchenker
Esri Contributor

Hi Armin

The layer (ILayer) should also implement IWMTSLayer. Go to IWMTSLayer.Connection to get the WMTSConnection-Object. This object also implements IWMTSServiceDescription: You get to the indidual LayerDescriptions (of type IWMTSLayerDescription) via the LayerDescription Property of the IWMTSServiceDescription-Interface. LayerDescription is a list, you Need to specify a layer index to get Access to the individual layer.

Best regards,
Matthias

0 Kudos
ArminMueller
New Contributor III

Hi Matthias,

i have tried this, but it seems that it doesnt work

wmtsLayer is a valid wmtsLayer. It shows me the TileMatrix and the name.

Dim wmtsCon As IWMTSConnection = New WMTSConnectionClass

wmtsLayer.WMTSConnection(wmtsCon)

wmtsService As IWMTSServiceDescription = CType(wmtsCon, IWMTSServiceDescription)

wmtsService gives me no information. All is empty

Armin

0 Kudos
MatthiasSchenker
Esri Contributor

Hi Armin

I believe that you need to explicitly open the connection object first. Here is what you need in C#. If I do this, I do get an object for the serviceDescription.

IWMTSLayer wmtsLayer = layer as IWMTSLayer;

IName wmtsName = wmtsLayer.DataSourceName;

IWMTSConnectionName wmtsConnectionName = wmtsName as IWMTSConnectionName;

WMTSConnection wmtsConnection = wmtsConnectionName.OpenEx(null) as WMTSConnection;

IWMTSServiceDescription wmtsServiceDescription = (IWMTSServiceDescription)wmtsConnection;


Matthias

ArminMueller
New Contributor III

Hi Matthias,

now it works. Thank you

Armin

0 Kudos
TomSchuller
Occasional Contributor III

Hy,

how can I choose in the WMTS-mapservice which sublayer should be displayed?

We have 1 WMTS-service with multiple layers in it.

I want to display only a specific layer from the WMTS-service

When I'm adding the simple "wmtsLayer", I'm always getting the first sublayer from it.

Thanks,

Tom

0 Kudos
AhmedEl-Sisi
Occasional Contributor III

You can get a specific Layer by assigning layer identifier to LAYERNAME property.

Something like the following:

    private ILayer GetSpecificWMTSLayer(string url, string layerID)
        {
            IWMTSLayer wmtsLayer = new WMTSLayer();
            WMTSConnectionName connectionName = new WMTSConnectionNameClass();
            IPropertySet propSet = new PropertySetClass();
            propSet.SetProperty("URL", url);
            propSet.SetProperty("LAYERNAME", layerID);
            connectionName.ConnectionProperties = propSet;
            wmtsLayer.Connect(connectionName as IName);
            return wmtsLayer as ILayer;
        }

These are the seven properties you can handle with your property set:

URL, LAYERNAME, USER, HIDEUSERPROPERTY, VERSION, PASSWORD, CONNECTIONPATH

WWalker
New Contributor III

Is there any documentation for these properties?

0 Kudos