ArcGIS API for Silverlight - Library Reference
WmtsLayer Class
Members  Example  See Also  Send comments on this topic
ESRI.ArcGIS.Client.Toolkit.DataSources Namespace : WmtsLayer Class

A layer that conforms to the Web Map Tiling Service (WMTS) Open GIS Consortium (OGC) standard. WMTS is a cached service that accesses pre-created tiles from a cache on a server’s hard drive instead of dynamically rendering images.

Object Model

WmtsLayer ClassEnvelope ClassSpatialReference ClassTimeExtent Class

Syntax

Visual Basic (Declaration) 
Public Class WmtsLayer 
   Inherits ESRI.ArcGIS.Client.TiledMapServiceLayer
C# 
public class WmtsLayer : ESRI.ArcGIS.Client.TiledMapServiceLayer 

Remarks

The full WMTS standard can be found on the OpenGIS Web Map Tile Service Implementation Standard web page. As of ArcGIS Server version 10.1 serving WMTS layers as a native REST service is supported.

In order to consume a WmtsLayer successfully the following Properties must be set:

  • Url (The WMTS service endpoint.)
  • ServiceMode (The WMTS service communication protocol.)

There are however several other optional Properties/Methods/Events that should also be set in order to avoid problems consuming a WmtsLayer, they are:

  • Initialized Method (Method raised when WmtsLayer is being created on the client; useful to get or change information about the layer.)
  • InitializationFailed Event (Method raised if the WmtsLayer has a problem being created.)
  • ProxyUrl Property (A proxy service to broker web requests between the WMTS service and the web client.)
  • Layer Property (Name of a single layer in a WMTS service; there can be multiple layers per service.)
  • ID Property (The unique ID of the layer in the Map control.)

A single WMTS service can have multiple layers. For each WmtsLayer instance, only one layer is drawn at a time. In order to discover what layers are available in a WMTS service, append the string '?request=GetCapabilities&service=WMTS&version=1.0.0' to what would be supplied for the WmtsLayer.Url Property in the address bar of a web browser and the full details will be provided in an XML document. A few example strings of obtaining the capabilities of a WMTS service are:

  • http://v2.suite.opengeo.org/geoserver/gwc/service/wmts?request=GetCapabilities&service=WMTS&version=1.0.0
  • http://MyTestServer:6080/arcgis/rest/services/cachedservices/MyTestWMTSService/MapServer/WMTS?request=GetCapabilities&service=WMTS&version=1.0.0

By default if the WmtsLayer.Layer Property is not specified, the first layer respecting the WmtsLayer.TileMatrixSet will be used. When specifying the WmtsLayer.Layer Property at runtime in the code-behind, the WmtsLayer’s Refresh Method fires which in turn invokes the WmtsLayer’s Initialized Event which will cause a re-draw of the layer in the Map Control.

It is important to specify the correct WmtsLayer.WmtsServiceMode Enumeration in the WmtsLayer.ServiceMode Property or the WmtsLayer may not be created properly. The two available WmtsLayer.WmtsServiceMode Enumeration options available are KVP and RESTful. WMTS services provided by ArcGIS Server produce RESTful WmtsLayer.WmtsServiceMode services. The KVP WmtsLayer.WmtsServiceMode means HTTP 'Key/Value Pair' encoding; details on this OGC specification can found by downloading the WCS Extension -- KVP Protocol document.

A call to the WmtsLayer is Asynchronous. As a result, this means that you cannot obtain valid Read (VB.NET) or get (C#) Property values until information has been returned from a WMTS server to the Client application. You can safely obtain valid Read/get Property information in the Initialized, PropertyChanged, TileLoaded, and TileLoading Events or from a function/sub/method that occurs after these Events fire. If you try to obtain Read/get Property information before these Events fire you will obtain invalid or null/Nothing information for the particular Property in question.

Example

How to use:

Select a layer name in the ListBox and click the 'Get WMTSLayer information' button to display various WMTSLayer and WMTSLayer.LayerInfo Property information. The Map will automatically zoom to the Extent of the layer. Properties with the words '[Count]' gives the count of the number of items in an IEnumerable; more coding could be done in the code-behind to dig deeper into the collection.

The XAML code in this example is used in conjunction with the code-behind (C# or VB.NET) to demonstrate the functionality.

The following screen shot corresponds to the code example in this page.

Example of displaying a WmtsLayer and detailed information about the service.

XAMLCopy Code
<Grid x:Name="LayoutRoot" Background="White">
  
  <!-- Add a Map Control. -->
  <esri:Map Background="White" HorizontalAlignment="Left" Name="Map1" 
            VerticalAlignment="Top" WrapAround="True" Height="400" Width="775" Margin="12,80,0,0">
    <esri:Map.Layers>
      <esri:LayerCollection>
          
        <!-- 
        Add a sample WmtsLayer. Setting the 'ID' Property is good if you want to access the WmtsLayer in code-behind.
        It is mandatory that you set the correct 'ServiceMode' Property. Setting the 'InitializationFailed' Event is useful
        to troubleshoot if the WmtsLayer fails to load. A 'ProxyUrl' is needed to test this particular service; it is not
        always necessary depending on your configuration (i.e. local web service internal to your network). Use the 
        'Initialized' Method to gain access to various Properties/Methods of the WmtsLayer.
        -->
        <esri:WmtsLayer ID="WMTS1"
                        Url="http://v2.suite.opengeo.org/geoserver/gwc/service/wmts"
                        Initialized="WmtsLayer_Initialized"
                        ProxyUrl="http://serverapps.esri.com/SilverlightDemos/ProxyPage/proxy.ashx"
                        InitializationFailed="WmtsLayer_InitializationFailed"
                        ServiceMode="KVP"
                        />
      </esri:LayerCollection>
    </esri:Map.Layers>
  </esri:Map>
  
  <!-- 
  Add a Button to allow the user to change the sub-Layer that is displaying in the Map along with information
  about the WmtsLayer service.
  -->
  <Button Content="Get WMTSLayer information" Height="23" HorizontalAlignment="Left" Margin="518,484,0,0" 
          Name="Button1" VerticalAlignment="Top" Width="269" Click="Button1_Click"/>
  <ListBox Height="103" HorizontalAlignment="Left" Margin="519,513,0,0" Name="ListBox1" 
           VerticalAlignment="Top" Width="269" />
  
  <!-- Display various WMTSLayer Property information. -->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="170,479,0,0" Name="Label_WMTSLayerProperties" 
             VerticalAlignment="Top" Width="199" Content="WMTSLayer Properties" FontSize="14" FontWeight="Bold"/>
  
  <!-- FullExtent-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="7,508,0,0" Name="Label_FullExtent" 
             VerticalAlignment="Top" Width="120" Content="FullExtent:" />
  <TextBox Height="23" HorizontalAlignment="Left" Margin="101,508,0,0" 
           Name="TextBox_FullExtent" VerticalAlignment="Top" Width="400" />
  
  <!--Description-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="7,540,0,0" Name="Label_Description" 
             VerticalAlignment="Top" Width="88" Content="Description:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="101,536,0,0" Name="TextBox_Description" 
           VerticalAlignment="Top" Width="400" />
  
  <!--ImageFormat-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="7,569,0,0" Name="Label_ImageFormat" 
             VerticalAlignment="Top" Width="88" Content="ImageFormat:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="101,565,0,0" Name="TextBox_ImageFormat" 
           VerticalAlignment="Top" Width="161" />
  
  <!--Layer-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="268,565,0,0" Name="Label_Layer" 
             VerticalAlignment="Top" Width="88" Content="Layer:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="309,565,0,0" Name="TextBox_Layer" 
           VerticalAlignment="Top" Width="192" />
  
  <!--LayerInfos-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="7,596,0,0" Name="Label_LayerInfos" 
             VerticalAlignment="Top" Width="140" Content="LayerInfos [Count]:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="119,593,0,0" Name="TextBox_LayerInfos" 
           VerticalAlignment="Top" Width="89" />
  
  <!--ProxyUrl-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="7,625,0,0" Name="Label_ProxyUrl" 
             VerticalAlignment="Top" Width="88" Content="ProxyUrl:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="101,622,0,0" Name="TextBox_ProxyUrl" 
           VerticalAlignment="Top" Width="400" />
  
  <!-- ServiceMode-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="225,597,0,0" Name="Label_ServiceMode" 
             VerticalAlignment="Top" Width="88" Content="ServiceMode:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="309,593,0,0" Name="TextBox_ServiceMode" 
           VerticalAlignment="Top" Width="192" />
  
  <!--Style-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="7,650,0,0" Name="Label_Style" 
             VerticalAlignment="Top" Width="88" Content="Style:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="101,650,0,0" Name="TextBox_Style" 
           VerticalAlignment="Top" Width="161" />
  
  <!--TileMatrixSet-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="268,654,0,0" Name="Label_TileMatrixSet" 
             VerticalAlignment="Top" Width="88" Content="TileMatrixSet:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="352,654,0,0" Name="TextBox_TileMatrixSet" 
           VerticalAlignment="Top" Width="149" />
  
  <!--Title-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="7,688,0,0" Name="Label_Title" 
             VerticalAlignment="Top" Width="120" Content="Title:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="101,684,0,0" Name="TextBox_Title" 
           VerticalAlignment="Top" Width="400" />
  
  <!--Token-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="7,717,0,0" Name="Label_Token" 
             VerticalAlignment="Top" Width="120" Content="Token:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="101,713,0,0" Name="TextBox_Token" 
           VerticalAlignment="Top" Width="400" />
  
  <!--Url-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="7,746,0,0" Name="Label_Url" 
             VerticalAlignment="Top" Width="120" Content="Url:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="101,742,0,0" Name="TextBox_Url" 
           VerticalAlignment="Top" Width="400" />
  
  <!--Version-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="7,775,0,0" Name="Label_Version" 
             VerticalAlignment="Top" Width="120" Content="Version:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="101,771,0,0" Name="TextBox_Version" 
           VerticalAlignment="Top" Width="400" />
  
  
  <!--Display detailed WMTSLayer.LayerInfo about the specific sub-Layer that is being displayed. -->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="543,622,0,0" Name="Label_WMTSLayerLayerInfo" 
             VerticalAlignment="Top" Width="187" Content="WMTSLayer.LayerInfo" FontSize="14" FontWeight="Bold" />
  
  <!--Abstract-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="511,656,0,0" Name="Label_Abstract" 
             VerticalAlignment="Top" Width="50" Content="Abstract:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="569,652,0,0" Name="TextBox_Abstract" 
           VerticalAlignment="Top" Width="67" />
  
  <!--Formats-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="642,654,0,0" Name="Label_Formats" 
             VerticalAlignment="Top" Width="97" Content="Formats [Count]:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="743,652,0,0" Name="TextBox_Formats" 
           VerticalAlignment="Top" Width="44" />
  
  <!--Identifier-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="508,683,0,0" Name="Label_Identifier" 
             VerticalAlignment="Top" Width="60" Content="Identifier:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="571,684,0,0" Name="TextBox_Identifier" 
           VerticalAlignment="Top" Width="216" />
  
  <!--Styles-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="511,713,0,0" Name="Label_Styles" 
             VerticalAlignment="Top" Width="86" Content="Styles [Count]:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="603,713,0,0" Name="TextBox_Styles" 
           VerticalAlignment="Top" Width="184" />
  
  <!--TileMatrixSets-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="507,742,0,0" Name="Label_TileMatrixSets" 
             VerticalAlignment="Top" Width="129" Content="TileMatrixSets [Count]:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="642,740,0,0" Name="TextBox_TileMatrixSets" 
           VerticalAlignment="Top" Width="145" />
  
  <!--Title-->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="513,768,0,0" Name="Label_Title2" 
             VerticalAlignment="Top" Width="48" Content="Title:"/>
  <TextBox Height="23" HorizontalAlignment="Left" Margin="554,769,0,0" Name="TextBox_Title2" 
           VerticalAlignment="Top" Width="236" />
  
  
  <!-- Provide the instructions on how to use the sample code. -->
  <TextBlock Height="74" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" Width="756" 
         TextWrapping="Wrap" Margin="12,12,0,0" 
         Text="Select a layer name in the ListBox and click the 'Get WMTSLayer information' button to display
         various WMTSLayer and WMTSLayer.LayerInfo Property information. The Map will automatically zoom to the
         Extent of the layer. Properties with the words '[Count]' gives the count of the number of items in 
         an IEnumerable; more coding could be done in the code-behind to dig deeper into the collection." />
  
</Grid>
C#Copy Code
private void Button1_Click(object sender, System.Windows.RoutedEventArgs e)
{
  // This function takes the user choice for a specific WmtsLayer.Layer from a ListBox and refreshes 
  // the Map using that layer.
  
  // Get the user choice for the name of the WmtsLayer.Layer.
  string theTitle = ListBox1.SelectedItem.ToString();
  
  // Get the WmtsLayer that was defined in XAML.
  ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer theWMTSLayer = (ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer)Map1.Layers["WMTS1"];
  
  // Set the specific layer to display in the WmtsLayer. This will internally cause a WmtsLayer.Refresh
  // which in turn causes the WmtsLayer.Initialized Method to execute.
  theWMTSLayer.Layer = theTitle;
}
            
private void WmtsLayer_Initialized(object sender, System.EventArgs e)
{
  // This function loops through all of the sub-Layers in a WmtsLayer service and displays information
  // about the WmtsLayer service in general and details about a particular WmtsLayer.Layer specified
  // by the user choice. This function initiates whenever the WmtsLayer first initializes or as a result 
  // of specifying a different WmtsLayer.Layer. 
  
  // Clear out all of the sub-Layer names of the WmtsLayer service.
  ListBox1.Items.Clear();
  
  // Get the WmtsLayer that was defined in XAML.
  ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer theWMTSLayer = (ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer)Map1.Layers["WMTS1"];
  
  // Get all of the sub-Layer information from the WmtsLayer.
  IEnumerable<ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer.WmtsLayerInfo> theLayers = theWMTSLayer.LayerInfos;
  if (theLayers != null)
  {
    foreach (ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer.WmtsLayerInfo oneWMTSLayerInfo in theLayers)
    {
  	//Display the name of the WmtsLayer sub-Layer's in the ListBox. 
  	ListBox1.Items.Add(oneWMTSLayerInfo.Title);
    }
  }
  
  // Set the Map.Extent to the WmtsLayer sub-Layer and display the numerical extent in a TextBox.
  if (theWMTSLayer.FullExtent != null)
  {
    Map1.Extent = theWMTSLayer.FullExtent;
    TextBox_FullExtent.Text = theWMTSLayer.FullExtent.ToString();
  }
  
  // Display the Description of the WmtsLayer service.
  if (theWMTSLayer.Description != null)
  {
    TextBox_Description.Text = theWMTSLayer.Description;
  }
  
  // Display the ImageFormat of the WmtsLayer service.
  if (theWMTSLayer.ImageFormat != null)
  {
    TextBox_ImageFormat.Text = theWMTSLayer.ImageFormat;
  }
  
  // Display the currently displaying sub-Layer name of the WmtsLayer service.
  if (theWMTSLayer.Layer != null)
  {
    TextBox_Layer.Text = theWMTSLayer.Layer;
  }
  
  // Display the LayerInfos.Count of the WmtsLayer service. More information is available if you
  // care to loop through the IEnumerable<WmtsLayer.WmtsLayerInfo> objects.
  if (theWMTSLayer.LayerInfos != null)
  {
    TextBox_LayerInfos.Text = theWMTSLayer.LayerInfos.Count.ToString();
  }
  
  // Display the ProxyUrl of the WmtsLayer service.
  if (theWMTSLayer.ProxyUrl != null)
  {
    TextBox_ProxyUrl.Text = theWMTSLayer.ProxyUrl;
  }
  
  // Display the ServiceMode Enumeration of the WmtsLayer service.
  TextBox_ServiceMode.Text = theWMTSLayer.ServiceMode.ToString(); //An Enumeration.
  
  // Display the Style of the WmtsLayer service.
  if (theWMTSLayer.Style != null)
  {
    TextBox_Style.Text = theWMTSLayer.Style;
  }
  
  // Display the TileMatrix of the WmtsLayer service.
  if (theWMTSLayer.TileMatrixSet != null)
  {
    TextBox_TileMatrixSet.Text = theWMTSLayer.TileMatrixSet;
  }
  
  // Display the Title of the WmtsLayer service. Select the name of the Title in the ListBox to
  // show which sub-Layer is currently being displayed in the Map.
  if (theWMTSLayer.Title != null)
  {
    TextBox_Title.Text = theWMTSLayer.Title;
    ListBox1.SelectedItem = theWMTSLayer.Title;
  }
  
  // Display the Token of the WmtsLayer service.
  if (theWMTSLayer.Token != null)
  {
    TextBox_Token.Text = theWMTSLayer.Token;
  }
  
  // Display the Url of the WmtsLayer service.
  if (theWMTSLayer.Url != null)
  {
    TextBox_Url.Text = theWMTSLayer.Url;
  }
  
  // Display the Version of the WmtsLayer service.
  if (theWMTSLayer.Version != null)
  {
    TextBox_Version.Text = theWMTSLayer.Version;
  }
  
  // Get the WmtsLayer.Title from the user choice in the ListBox. This will be used to display detailed 
  // information (WmtsLayer.WmtsLayerInfo) about the specific WmtsLayer.Layer currently being shown in the map.
  string theTitle = null;
  if (ListBox1.SelectedItem != null)
  {
    theTitle = ListBox1.SelectedItem.ToString();
  }
  
  // Loop through all of the sub-Layers of the WmtsLayer and display WmtsLayer.WmtsLayerInfo Property
  // information that match the user choice in the ListBox.
  if (theLayers != null)
  {
    foreach (ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer.WmtsLayerInfo oneWMTSLayerInfo in theLayers)
    {
      if (oneWMTSLayerInfo.Title == theTitle)
      {
        // Display the Abstract of the WmtsLayer.WmtsLayerInfo sub-Layer.
        if (oneWMTSLayerInfo.Abstract != null)
        {
          TextBox_Abstract.Text = oneWMTSLayerInfo.Abstract;
        }
        
        // Display the Formats of the WmtsLayer.WmtsLayerInfo sub-Layer. More information is available if you
        // care to loop through the IEnumerable<String> objects.
        if (oneWMTSLayerInfo.Formats != null)
        {
          TextBox_Formats.Text = oneWMTSLayerInfo.Formats.Count.ToString();
        }
        
        // Display the Identifier of the WmtsLayer.WmtsLayerInfo sub-Layer.
        if (oneWMTSLayerInfo.Identifier != null)
        {
          TextBox_Identifier.Text = oneWMTSLayerInfo.Identifier;
        }
        
        // Display the Styles of the WmtsLayer.WmtsLayerInfo sub-Layer. More information is available if you
        // care to loop through the IEnumerable<String> objects.
        if (oneWMTSLayerInfo.Styles != null)
        {
          TextBox_Styles.Text = oneWMTSLayerInfo.Styles.Count.ToString();
        }
        
        // Display the TileMatrixSets of the WmtsLayer.WmtsLayerInfo sub-Layer. More information is available if you
        // care to loop through the IEnumerable<String> objects.
        if (oneWMTSLayerInfo.TileMatrixSets != null)
        {
          TextBox_TileMatrixSets.Text = oneWMTSLayerInfo.TileMatrixSets.Count.ToString();
        }
        
        // Display the Title of the WmtsLayer.WmtsLayerInfo sub-Layer.
        if (oneWMTSLayerInfo.Title != null)
        {
          TextBox_Title2.Text = oneWMTSLayerInfo.Title;
        }
      }
    }
  }
}
            
private void WmtsLayer_InitializationFailed(object sender, System.EventArgs e)
{
  // This function displays any error information of the WmtsLayer fails to load.
  
  ESRI.ArcGIS.Client.Layer aLayer = (ESRI.ArcGIS.Client.Layer)sender;
  MessageBox.Show(aLayer.InitializationFailure.Message);
}
VB.NETCopy Code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
  
  ' This function takes the user choice for a specific WmtsLayer.Layer from a ListBox and refreshes 
  ' the Map using that layer.
  
  ' Get the user choice for the name of the WmtsLayer.Layer.
  Dim theTitle As String = ListBox1.SelectedItem.ToString
  
  ' Get the WmtsLayer that was defined in XAML.
  Dim theWMTSLayer As ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer = Map1.Layers("WMTS1")
  
  ' Set the specific layer to display in the WmtsLayer. This will internally cause a WmtsLayer.Refresh
  ' which in turn causes the WmtsLayer.Initialized Method to execute.
  theWMTSLayer.Layer = theTitle
  
End Sub
  
Private Sub WmtsLayer_Initialized(ByVal sender As System.Object, ByVal e As System.EventArgs)
  
  ' This function loops through all of the sub-Layers in a WmtsLayer service and displays information
  ' about the WmtsLayer service in general and details about a particular WmtsLayer.Layer specified
  ' by the user choice. This function initiates whenever the WmtsLayer first initializes or as a result 
  ' of specifying a different WmtsLayer.Layer. 
  
  ' Clear out all of the sub-Layer names of the WmtsLayer service.
  ListBox1.Items.Clear()
  
  ' Get the WmtsLayer that was defined in XAML.
  Dim theWMTSLayer As ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer = Map1.Layers("WMTS1")
  
  ' Get all of the sub-Layer information from the WmtsLayer.
  Dim theLayers As IEnumerable(Of ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer.WmtsLayerInfo) = theWMTSLayer.LayerInfos
  If theLayers IsNot Nothing Then
    For Each oneWMTSLayerInfo As ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer.WmtsLayerInfo In theLayers
      'Display the name of the WmtsLayer sub-Layer's in the ListBox. 
      ListBox1.Items.Add(oneWMTSLayerInfo.Title)
    Next
  End If
  
  ' Set the Map.Extent to the WmtsLayer sub-Layer and display the numerical extent in a TextBox.
  If theWMTSLayer.FullExtent IsNot Nothing Then
    Map1.Extent = theWMTSLayer.FullExtent
    TextBox_FullExtent.Text = theWMTSLayer.FullExtent.ToString
  End If
  
  ' Display the Description of the WmtsLayer service.
  If theWMTSLayer.Description IsNot Nothing Then
    TextBox_Description.Text = theWMTSLayer.Description
  End If
  
  ' Display the ImageFormat of the WmtsLayer service.
  If theWMTSLayer.ImageFormat IsNot Nothing Then
    TextBox_ImageFormat.Text = theWMTSLayer.ImageFormat
  End If
  
  ' Display the currently displaying sub-Layer name of the WmtsLayer service.
  If theWMTSLayer.Layer IsNot Nothing Then
    TextBox_Layer.Text = theWMTSLayer.Layer
  End If
  
  ' Display the LayerInfos.Count of the WmtsLayer service. More information is available if you
  ' care to loop through the IEnumerable(Of WmtsLayer.WmtsLayerInfo) objects.
  If theWMTSLayer.LayerInfos IsNot Nothing Then
    TextBox_LayerInfos.Text = theWMTSLayer.LayerInfos.Count.ToString
  End If
  
  ' Display the ProxyUrl of the WmtsLayer service.
  If theWMTSLayer.ProxyUrl IsNot Nothing Then
    TextBox_ProxyUrl.Text = theWMTSLayer.ProxyUrl
  End If
  
  ' Display the ServiceMode Enumeration of the WmtsLayer service.
  TextBox_ServiceMode.Text = theWMTSLayer.ServiceMode.ToString 'An Enumeration.
  
  ' Display the Style of the WmtsLayer service.
  If theWMTSLayer.Style IsNot Nothing Then
    TextBox_Style.Text = theWMTSLayer.Style
  End If
  
  ' Display the TileMatrix of the WmtsLayer service.
  If theWMTSLayer.TileMatrixSet IsNot Nothing Then
    TextBox_TileMatrixSet.Text = theWMTSLayer.TileMatrixSet
  End If
  
  ' Display the Title of the WmtsLayer service. Select the name of the Title in the ListBox to
  ' show which sub-Layer is currently being displayed in the Map.
  If theWMTSLayer.Title IsNot Nothing Then
    TextBox_Title.Text = theWMTSLayer.Title
    ListBox1.SelectedItem = theWMTSLayer.Title
  End If
  
  ' Display the Token of the WmtsLayer service.
  If theWMTSLayer.Token IsNot Nothing Then
    TextBox_Token.Text = theWMTSLayer.Token
  End If
  
  ' Display the Url of the WmtsLayer service.
  If theWMTSLayer.Url IsNot Nothing Then
    TextBox_Url.Text = theWMTSLayer.Url
  End If
  
  ' Display the Version of the WmtsLayer service.
  If theWMTSLayer.Version IsNot Nothing Then
    TextBox_Version.Text = theWMTSLayer.Version
  End If
  
  ' Get the WmtsLayer.Title from the user choice in the ListBox. This will be used to display detailed 
  ' information (WmtsLayer.WmtsLayerInfo) about the specific WmtsLayer.Layer currently being shown in the map.
  Dim theTitle As String = Nothing
  If ListBox1.SelectedItem IsNot Nothing Then
    theTitle = ListBox1.SelectedItem.ToString
  End If
  
  ' Loop through all of the sub-Layers of the WmtsLayer and display WmtsLayer.WmtsLayerInfo Property
  ' information that match the user choice in the ListBox.
  If theLayers IsNot Nothing Then
    For Each oneWMTSLayerInfo As ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer.WmtsLayerInfo In theLayers
      If oneWMTSLayerInfo.Title = theTitle Then
        
        ' Display the Abstract of the WmtsLayer.WmtsLayerInfo sub-Layer.
        If oneWMTSLayerInfo.Abstract IsNot Nothing Then
          TextBox_Abstract.Text = oneWMTSLayerInfo.Abstract
        End If
        
        ' Display the Formats of the WmtsLayer.WmtsLayerInfo sub-Layer. More information is available if you
        ' care to loop through the IEnumerable(Of String) objects.
        If oneWMTSLayerInfo.Formats IsNot Nothing Then
          TextBox_Formats.Text = oneWMTSLayerInfo.Formats.Count.ToString
        End If
        
        ' Display the Identifier of the WmtsLayer.WmtsLayerInfo sub-Layer.
        If oneWMTSLayerInfo.Identifier IsNot Nothing Then
          TextBox_Identifier.Text = oneWMTSLayerInfo.Identifier
        End If
        
        ' Display the Styles of the WmtsLayer.WmtsLayerInfo sub-Layer. More information is available if you
        ' care to loop through the IEnumerable(Of String) objects.
        If oneWMTSLayerInfo.Styles IsNot Nothing Then
          TextBox_Styles.Text = oneWMTSLayerInfo.Styles.Count.ToString
        End If
        
        ' Display the TileMatrixSets of the WmtsLayer.WmtsLayerInfo sub-Layer. More information is available if you
        ' care to loop through the IEnumerable(Of String) objects.
        If oneWMTSLayerInfo.TileMatrixSets IsNot Nothing Then
          TextBox_TileMatrixSets.Text = oneWMTSLayerInfo.TileMatrixSets.Count.ToString
        End If
        
        ' Display the Title of the WmtsLayer.WmtsLayerInfo sub-Layer.
        If oneWMTSLayerInfo.Title IsNot Nothing Then
          TextBox_Title2.Text = oneWMTSLayerInfo.Title
        End If
        
      End If
    Next
  End If
  
End Sub
  
Private Sub WmtsLayer_InitializationFailed(ByVal sender As System.Object, ByVal e As System.EventArgs)
  
  ' This function displays any error information of the WmtsLayer fails to load.
  
  Dim aLayer As ESRI.ArcGIS.Client.Layer = sender
  MessageBox.Show(aLayer.InitializationFailure.Message)
  
End Sub

Inheritance Hierarchy

System.Object
   System.Windows.DependencyObject
      ESRI.ArcGIS.Client.Layer
         ESRI.ArcGIS.Client.TiledLayer
            ESRI.ArcGIS.Client.TiledMapServiceLayer
               ESRI.ArcGIS.Client.Toolkit.DataSources.WmtsLayer

Requirements

Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7

See Also

© ESRI, Inc. All Rights Reserved.