WmtsLayer Class |
Namespace: Esri.ArcGISRuntime.Mapping
public sealed class WmtsLayer : ImageTiledLayer
The WmtsLayer type exposes the following members.
Name | Description | |
---|---|---|
![]() | WmtsLayer |
Initializes a new instance of the WmtsLayer class.
|
![]() ![]() | WmtsLayer(WmtsLayerInfo) |
Initializes a new instance of the WmtsLayer class from the given
layer info. PreferredImageFormat and TileMatrixSet will be
chosen automatically.
|
![]() ![]() | WmtsLayer(Uri, String) |
Initializes a new instance of the WmtsLayer class with the given
service URI and layer ID. PreferredImageFormat and TileMatrixSet
will be chosen automatically.
|
![]() | WmtsLayer(WmtsLayerInfo, TileImageFormat) |
Initializes a new instance of the WmtsLayer class for the given
layer info and tile image format. TileMatrixSet will be chosen automatically.
|
![]() | WmtsLayer(WmtsLayerInfo, WmtsTileMatrixSet) |
Initializes a new instance of the WmtsLayer class from the given
layer info and tile matrix set. PreferredImageFormat will be chosen automatically.
|
![]() | WmtsLayer(Uri, String, TileImageFormat) |
Initializes a new instance of the WmtsLayer class with the given
service URI, layer ID, and preferred tile image format. TileMatrixSet will be
chosen automatically.
|
![]() | WmtsLayer(Uri, String, String) |
Initializes a new instance of the WmtsLayer class with the given
service URI, layer ID, and tile matrix set ID. PreferredImageFormat will be
chosen automatically.
|
![]() | WmtsLayer(WmtsLayerInfo, WmtsTileMatrixSet, TileImageFormat) |
Initializes a new instance of the WmtsLayer class for the given
layer info, tile matrix set, and tile image format.
|
![]() | WmtsLayer(Uri, String, String, TileImageFormat) |
Initializes a new instance of the WmtsLayer class with the given
service URI, layer ID, tile matrix set ID,
and tile image format.
|
Name | Description | |
---|---|---|
![]() | Attribution |
Gets the attribution text for the layer.
(Inherited from Layer.) |
![]() | Brightness |
Gets or sets layer brightness level.
(Inherited from ImageAdjustmentLayer.) |
![]() | CanChangeVisibility |
Gets a value indicating whether the layer content's visibility can be changed.
(Inherited from Layer.) |
![]() | Contrast |
Gets or sets layer contrast level.
(Inherited from ImageAdjustmentLayer.) |
![]() | CustomParameters |
Gets the dictionary of custom parameters to be sent with WMTS requests issued by this layer.
|
![]() | Description |
Gets the description for the layer.
(Inherited from Layer.) |
![]() | FullExtent |
Gets or sets the full extent of this layer.
(Inherited from ImageTiledLayer.) |
![]() | Gamma |
Gets or sets layer gamma level.
(Inherited from ImageAdjustmentLayer.) |
![]() ![]() | Id |
Gets or sets an identifier for the layer
(Inherited from Layer.) |
![]() | IsIdentifyEnabled |
Gets a value indicating whether the layer supports the identify operation.
(Inherited from Layer.) |
![]() ![]() | IsVisible |
Gets or sets a value indicating whether the layer content is visible.
(Inherited from Layer.) |
![]() | Item | Gets the ArcGIS Item (Inherited from Layer.) |
![]() | LayerId |
Gets or sets the WMTS layer identifier.
|
![]() | LayerInfo |
Gets the WmtsLayerInfo for this layer.
|
![]() | LoadError |
Gets the load error of the layer, if there is one.
(Inherited from Layer.) |
![]() ![]() | LoadStatus |
Gets the load status of the layer.
(Inherited from Layer.) |
![]() ![]() | MaxScale |
Gets or sets the maximum scale where the layer is visible.
(Inherited from Layer.) |
![]() ![]() | MinScale |
Gets or sets the minimum scale where the layer is visible.
(Inherited from Layer.) |
![]() ![]() | Name |
Gets or sets the name of the layer content.
(Inherited from Layer.) |
![]() | NoDataTileBehavior |
Gets or sets the NoDataTileBehavior for the .
The value controls how a tile returning 'NoData' will be resampled.
(Inherited from ImageTiledLayer.) |
![]() ![]() | Opacity |
Gets or sets the opacity of the layer.
(Inherited from Layer.) |
![]() | PreferredImageFormat |
Gets or sets the preferred image format used for tiles of this WMTS layer.
The layer will try to request tiles in this format if possible.
|
![]() | ShowInLegend |
Gets or sets a value indicating whether the layer content participates in the legend.
(Inherited from Layer.) |
![]() | Source |
Gets or sets the service Uri for this WMTS layer.
|
![]() | SpatialReference |
Gets the spatial reference of the layer.
(Inherited from Layer.) |
![]() ![]() | SublayerContents |
Gets the sub layer contents of a layer content.
(Inherited from Layer.) |
![]() | TileInfo |
Gets or sets the tiling scheme information for this layer.
(Inherited from ImageTiledLayer.) |
![]() | TileMatrixSet |
Gets the TileMatrixSet for this layer.
|
![]() | TileMatrixSetId |
Gets or sets the tile matrix set identifier.
|
Name | Description | |
---|---|---|
![]() | CancelLoad |
Cancels an ongoing load.
(Inherited from Layer.) |
![]() ![]() | Clone |
Clones this instance of Layer and its members.
(Inherited from Layer.) |
![]() | GetLegendInfosAsync |
Returns an immutable list of LegendInfo.
(Inherited from Layer.) |
![]() | IsVisibleAtScale |
Returns the layer content's effective visibility at the specified scale.
(Inherited from Layer.) |
![]() ![]() | LoadAsync |
Initiates loading of a layer
(Inherited from Layer.) |
![]() | RetryLoadAsync |
Retry loading the layer.
(Inherited from Layer.) |
Name | Description | |
---|---|---|
![]() ![]() | Loaded |
Occurs when the layer is loaded.
(Inherited from Layer.) |
![]() | LoadStatusChanged |
Occurs when the layer LoadStatus is changed.
(Inherited from Layer.) |
![]() | PropertyChanged |
Occurs when a property value changes.
(Inherited from Layer.) |
Web Map Tile Service (WMTS) is an Open GeospatialConsortium (OGC) standard for delivering geographic data via raster tiles. ArcGIS Runtime supports WMTS 1.0.0. The service may be hosted in the cloud on ArcGIS Online, on a third party server, or on-premises with ArcGIS Server.
A WMTS layer uses pre-generated tiles to create a map instead of dynamically generating map images.
Functional characteristics
The maps provided by a WMTS service use predefined symbology defined by the server. As a result, it is not possible to apply custom renderers or to visualize feature selection.
A WMTS service can contain multiple layers in a hierarchy. A WMTS layer can be constructed directly with a URL to a service and the uniquely identifying name of the desired layer. Alternatively, a WMTS service can be used to programmatically explore the available layers and allow the user to choose layers at run time.
When creating a WmtsLayer from URL: For some WMTS services it may be necessary to provide a direct URI to the getCapabilities resource, by appending either /1.0.0/WMTSCapabilities.xml or ?service=wmts&request=getCapabilities&version=1.0.0 to the root WMTS URI.
Performance characteristics
WMTS layer consumes raster tiles that were prerendered by a server. WMTS requires fewer server resources than WMS because the images are rendered and cached ahead of time. WMTS layer requires a connection to the service at all times.
Sample Code:
Android
Example Name: WMTSLayer
Display a layer from a Web Map Tile Service.
// Copyright 2017 Esri. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. // You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific // language governing permissions and limitations under the License. using Android.App; using Android.OS; using Android.Widget; using Esri.ArcGISRuntime.Mapping; using Esri.ArcGISRuntime.Ogc; using Esri.ArcGISRuntime.UI.Controls; using System; using System.Collections.Generic; namespace ArcGISRuntime.Samples.WMTSLayer { [Activity (ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)] [ArcGISRuntime.Samples.Shared.Attributes.Sample( name: "WMTS layer", category: "Layers", description: "Display a layer from a Web Map Tile Service.", instructions: "The layer will be displayed automatically. Use the buttons to choose a different method of loading the layer.", tags: new[] { "OGC", "layer", "raster", "tiled", "web map tile service" })] public class WMTSLayer : Activity { // Hold a reference to the map view private MapView _myMapView; // Button for loading layer using Uri constructor. private Button _uriButton; // Button for loading layer using WmtsService. private Button _infoButton; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Title = "WMTS layer"; // Create the UI, setup the control references CreateLayout(); // Load the map using Uri to the WMTS service. LoadWMTSLayer(true); } private void UriButton_Clicked(object sender, EventArgs e) { //Load the WMTS layer using Uri method. LoadWMTSLayer(true); // Disable and enable the appropriate buttons. _uriButton.Enabled = false; _infoButton.Enabled = true; } private void InfoButton_Clicked(object sender, EventArgs e) { //Load the WMTS layer using layer info. LoadWMTSLayer(false); // Disable and enable the appropriate buttons. _uriButton.Enabled = true; _infoButton.Enabled = false; } private async void LoadWMTSLayer(bool uriMode) { try { // Create a new map. Map myMap = new Map(); // Get the basemap from the map. Basemap myBasemap = myMap.Basemap; // Get the layer collection for the base layers. LayerCollection myLayerCollection = myBasemap.BaseLayers; // Create an instance for the WMTS layer. WmtsLayer myWmtsLayer; // Define the Uri to the WMTS service. Uri wmtsUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS"); if (uriMode) { // Create a WMTS layer using a Uri and provide an Id value. myWmtsLayer = new WmtsLayer(wmtsUri, "WorldTimeZones"); } else { // Define a new instance of the WMTS service. WmtsService myWmtsService = new WmtsService(wmtsUri); // Load the WMTS service. await myWmtsService.LoadAsync(); // Get the service information (i.e. metadata) about the WMTS service. WmtsServiceInfo myWmtsServiceInfo = myWmtsService.ServiceInfo; // Obtain the read only list of WMTS layer info objects. IReadOnlyList<WmtsLayerInfo> myWmtsLayerInfos = myWmtsServiceInfo.LayerInfos; // Create a WMTS layer using the first item in the read only list of WMTS layer info objects. myWmtsLayer = new WmtsLayer(myWmtsLayerInfos[0]); } // Add the WMTS layer to the layer collection of the map. myLayerCollection.Add(myWmtsLayer); // Assign the map to the MapView. _myMapView.Map = myMap; } catch (Exception ex) { AlertDialog alert = new AlertDialog.Builder(this).Create(); alert.SetMessage(ex.Message); alert.Show(); } } private void CreateLayout() { // Create a new vertical layout for the app LinearLayout layout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // Create Button _uriButton = new Button(this) { Text = "WMTSLayer via Uri" }; _uriButton.Click += UriButton_Clicked; _uriButton.Enabled = false; // Add Button to the layout layout.AddView(_uriButton); // Create Button _infoButton = new Button(this) { Text = "WMTSLayer via WmtsLayerInfo" }; _infoButton.Click += InfoButton_Clicked; // Add Button to the layout layout.AddView(_infoButton); // Add the map view to the layout _myMapView = new MapView(this); layout.AddView(_myMapView); // Show the layout in the app SetContentView(layout); } } }
Xamarin Forms Android
Example Name: WMTSLayer
Display a layer from a Web Map Tile Service.
// Copyright 2017 Esri. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. // You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific // language governing permissions and limitations under the License. using Esri.ArcGISRuntime.Mapping; using Esri.ArcGISRuntime.Ogc; using System; using System.Collections.Generic; using Xamarin.Forms; namespace ArcGISRuntime.Samples.WMTSLayer { [ArcGISRuntime.Samples.Shared.Attributes.Sample( name: "WMTS layer", category: "Layers", description: "Display a layer from a Web Map Tile Service.", instructions: "The layer will be displayed automatically. Use the buttons to choose a different method of loading the layer.", tags: new[] { "OGC", "layer", "raster", "tiled", "web map tile service" })] public partial class WMTSLayer : ContentPage { public WMTSLayer() { InitializeComponent(); LoadWMTSLayer(true); } private void UriButton_Click(object sender, EventArgs e) { //Load the WMTS layer using Uri method. LoadWMTSLayer(true); // Disable and enable the appropriate buttons. UriButton.IsEnabled = false; InfoButton.IsEnabled = true; } private void InfoButton_Click(object sender, EventArgs e) { //Load the WMTS layer using layer info. LoadWMTSLayer(false); // Disable and enable the appropriate buttons. UriButton.IsEnabled = true; InfoButton.IsEnabled = false; } private async void LoadWMTSLayer(bool uriMode) { try { // Create a new map. Map myMap = new Map(); // Get the basemap from the map. Basemap myBasemap = myMap.Basemap; // Get the layer collection for the base layers. LayerCollection myLayerCollection = myBasemap.BaseLayers; // Create an instance for the WMTS layer. WmtsLayer myWmtsLayer; // Define the Uri to the WMTS service. Uri wmtsUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS"); if (uriMode) { // Create a WMTS layer using a Uri and provide an Id value. myWmtsLayer = new WmtsLayer(wmtsUri, "WorldTimeZones"); } else { // Define a new instance of the WMTS service. WmtsService myWmtsService = new WmtsService(wmtsUri); // Load the WMTS service. await myWmtsService.LoadAsync(); // Get the service information (i.e. metadata) about the WMTS service. WmtsServiceInfo myWmtsServiceInfo = myWmtsService.ServiceInfo; // Obtain the read only list of WMTS layer info objects. IReadOnlyList<WmtsLayerInfo> myWmtsLayerInfos = myWmtsServiceInfo.LayerInfos; // Create a WMTS layer using the first item in the read only list of WMTS layer info objects. myWmtsLayer = new WmtsLayer(myWmtsLayerInfos[0]); } // Add the WMTS layer to the layer collection of the map. myLayerCollection.Add(myWmtsLayer); // Assign the map to the MapView. MyMapView.Map = myMap; // Zoom to appropriate level for iOS. await MyMapView.SetViewpointScaleAsync(300000000); } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Sample error", ex.ToString(), "OK"); } } } }
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms" xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime" x:Class="ArcGISRuntime.Samples.WMTSLayer.WMTSLayer"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="60" /> <RowDefinition Height="60" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Button x:Name="UriButton" Text="WMTSLayer via Uri" Clicked="UriButton_Click" Grid.Row="0" IsEnabled="false" /> <Button x:Name="InfoButton" Text="WMTSLayer via WmtsLayerInfo" Clicked="InfoButton_Click" Grid.Row="1" /> <esriUI:MapView x:Name="MyMapView" Grid.Row="2" /> </Grid> </ContentPage>
Hyperlink to Example | Description |
---|---|
WMTSLayer | Display a layer from a Web Map Tile Service. |