public class

WMTSLayer

extends TiledServiceLayer
java.lang.Object
   ↳ com.esri.android.map.Layer
     ↳ com.esri.android.map.TiledLayer
       ↳ com.esri.android.map.TiledServiceLayer
         ↳ com.esri.android.map.ogc.WMTSLayer

Class Overview

A Web Map Tile Service (WMTS) layer is based on data from an Open Geospatial Consortium (OGC), WMTS server. OGC WMTS is an OpenGIS standard specification for interactive mapping based on requesting map tiles from a server over the Internet. The WMTS layer allows you to access these services over the Internet and add their content to a map.

An instance of a WMTSLayer is created with either a URL or an instance of WMTSLayerInfo. WMTSLayer supports two modes: REST and KVP (Key Value Pairs). These are defined in WMTSServiceMode. When using REST mode, the URL for the service should be the location of the WMTSCapabilities.xml file that describes the service. Note that this file could be called anything. When using KVP mode, the URL for the service should be the URL used to query the service for information.

REST mode URL:

 WMTSLayer layer = new WMTSLayer("http://[SERVER:PORT]/[INSTANCE]/services/[SERVICE]/MapServer/WMTS/1.0.0/WMTSCapabilities.xml");
 
KVP mode URL:

 WMTSLayer layer = new WMTSLayer("http://[SERVER:PORT]/[PATH]/[TO]/[WMTS]/[QUERY]/[URL]");
 

An instance of a WMTSLayer can also be created from a WMTSLayerInfo instance. This shows the use of a REST URL but a KVP one could also be used.

 WMTSServiceInfo serviceInfo = WMTSServiceInfo.fetch("http://[SERVER:PORT]/[INSTANCE]/services/[SERVICE]/MapServer/WMTS/1.0.0/WMTSCapabilities.xml");
 WMTSLayerInfo layerInfo = serviceInfo.getLayerInfos().get(0);
 WMTSLayer layer = new WMTSLayer(layerInfo, SpatialReference.create(3857));
 layer.layerInitialise();
 

Summary

[Expand]
Inherited Constants
From class com.esri.android.map.TiledServiceLayer
[Expand]
Inherited Fields
From class com.esri.android.map.TiledServiceLayer
From class com.esri.android.map.TiledLayer
From class com.esri.android.map.Layer
Public Constructors
WMTSLayer(String url)
This constructor is used if you're instantiating the WMTSLayer using a URL string (see the class description for an example of this usage).
WMTSLayer(String url, UserCredentials credentials)
This constructor is used if you're instantiating the WMTSLayer using a URL string for a secured service.
WMTSLayer(String url, UserCredentials credentials, boolean initLayer)
This constructor is used if you're instantiating the WMTSLayer using a URL string for a secured service.
WMTSLayer(WMTSLayerInfo layerInfo, SpatialReference spatialReference)
This constructor is used if you're instantiating the WMTSLayer using WMTSLayerInfo instance (see the class description for an example of this usage).
WMTSLayer(WMTSLayerInfo layerInfo, SpatialReference spatialReference, String templateUrl)
Internal use only
Public Methods
String getFormat()
Gets the mime type of the image format being used to display the map.
String getLayerId()
Gets the service's identifier for this layer.
String getName()
Gets the name of the layer.
WMTSServiceMode getServiceMode()
Gets the current mode that the layer is using to query the service: either REST or KVP.
String getStyle()
Gets the layer style used when displaying the layer.
String getTitle()
Gets the title of the Layer.
WMTSServiceInfo getWmtsServiceInfo()
Gets information on the service this layer comes from.
void layerInitialise()
When using the WMTSLayer(String, UserCredentials, boolean) constructor with the initLayer parameter set to false or the WMTSLayer(WMTSLayerInfo, SpatialReference) constructor, this method needs to be called before adding the layer to a map.
void setFormat(String format)
Sets the mime type for the image format to be used to display the map
void setLayerId(String layerId)
Set the layer's identifier.
void setServiceMode(WMTSServiceMode serviceMode)
Sets the current mode that the layer is using to query the service: either REST or KVP.
void setStyle(String style)
Sets the layer style to use when displaying the layer.
void setTileMatrixSet(String tileMatrixSet)
Sets the tile matrix set that will be used to determine the tiles to be requested from the server.
Protected Methods
byte[] getTile(int level, int col, int row)
Override this method to implement fetching tiles from a tile service
void initLayer()
Initializes the layer.
[Expand]
Inherited Methods
From class com.esri.android.map.TiledServiceLayer
From class com.esri.android.map.TiledLayer
From class com.esri.android.map.Layer
From class java.lang.Object
From interface com.esri.android.map.popup.PopupLayer

Public Constructors

public WMTSLayer (String url)

This constructor is used if you're instantiating the WMTSLayer using a URL string (see the class description for an example of this usage). This constructor will use default values for style, format, service mode and tile matrix set. This will be the first value of each as listed in the capabilities XML for the service. If you wish to override the defaults, use the WMTSLayer(String, UserCredentials, boolean) constructor along with layerInitialise().

Parameters
url String: the URL of the web map tile service

public WMTSLayer (String url, UserCredentials credentials)

This constructor is used if you're instantiating the WMTSLayer using a URL string for a secured service. This constructor will use default values for style, format, service mode and tile matrix set. This will be the first value of each as listed in the capabilities XML for the service. If you wish to override the defaults, use the WMTSLayer(String, UserCredentials, boolean) constructor along with layerInitialise().

Parameters
url String: the URL of the web map tile service
credentials UserCredentials: the credentials used for accessing a secure tiled map service

public WMTSLayer (String url, UserCredentials credentials, boolean initLayer)

This constructor is used if you're instantiating the WMTSLayer using a URL string for a secured service. Set the initLayer parameter to true to initialise the layer as it is constructed. If you wish to use something other than the defaults for style, format, service mode or tile matrix set, set the initLayer parameter to false and call layerInitialise().

Parameters
url String: the URL of the tiled map service
credentials UserCredentials: the credentials used for accessing a secure tiled map service
initLayer boolean: set to true to initialize layer

public WMTSLayer (WMTSLayerInfo layerInfo, SpatialReference spatialReference)

This constructor is used if you're instantiating the WMTSLayer using WMTSLayerInfo instance (see the class description for an example of this usage). This version of the constructor will not initialise the layer so you will need to call layerInitialise() before adding to the map.

Parameters
layerInfo WMTSLayerInfo: WMTSLayerInfo instance for the layer we want to use
spatialReference SpatialReference: layer's spatial reference

public WMTSLayer (WMTSLayerInfo layerInfo, SpatialReference spatialReference, String templateUrl)

Internal use only

Parameters
layerInfo WMTSLayerInfo
spatialReference SpatialReference
templateUrl String

Public Methods

public String getFormat ()

Gets the mime type of the image format being used to display the map.

Returns
String the mime type of the image format being used to display the map

public String getLayerId ()

Gets the service's identifier for this layer.

Returns
String the service's identifier for this layer

public String getName ()

Gets the name of the layer. The name is the name of the service if the layer is associated with a service, otherwise it is null. You should not call this method until the layer is initialized.

Returns
String the name of the associated service or null otherwise.

public WMTSServiceMode getServiceMode ()

Gets the current mode that the layer is using to query the service: either REST or KVP.

Returns
WMTSServiceMode the current mode that the layer is using to query the service

public String getStyle ()

Gets the layer style used when displaying the layer.

Returns
String style layer style used when displaying the layer

public String getTitle ()

Gets the title of the Layer. WebMap may define title of a layer, when the layer is instantiated from a WebMap, it may have a tile.

Returns
String Returns the title.

public WMTSServiceInfo getWmtsServiceInfo ()

Gets information on the service this layer comes from.

Returns
WMTSServiceInfo information on the service this layer comes from

public void layerInitialise ()

When using the WMTSLayer(String, UserCredentials, boolean) constructor with the initLayer parameter set to false or the WMTSLayer(WMTSLayerInfo, SpatialReference) constructor, this method needs to be called before adding the layer to a map. This will allow changing the style, format service mode or tile matrix set from the defaults before initialising and adding to the map.

public void setFormat (String format)

Sets the mime type for the image format to be used to display the map

Parameters
format String: the mime type for the image format to be used to display the map

public void setLayerId (String layerId)

Set the layer's identifier. This will override the identifier provided by the WMTS service.

Parameters
layerId String: new identifier for the layer

public void setServiceMode (WMTSServiceMode serviceMode)

Sets the current mode that the layer is using to query the service: either REST or KVP.

Parameters
serviceMode WMTSServiceMode: either REST or KVP

public void setStyle (String style)

Sets the layer style to use when displaying the layer.

Parameters
style String: layer style to use when displaying the layer

public void setTileMatrixSet (String tileMatrixSet)

Sets the tile matrix set that will be used to determine the tiles to be requested from the server. A list of available tile matrix sets can be read from getTileMatrixSets().

Parameters
tileMatrixSet String: the tile matrix set that will be used to determine the tiles to be requested

Protected Methods

protected byte[] getTile (int level, int col, int row)

Override this method to implement fetching tiles from a tile service

Parameters
level int: an integer representing the scale level
col int: an integer representing the column
row int: an integer representing the row
Returns
byte[] byte array of tiles
Throws
Exception

protected void initLayer ()

Initializes the layer. The implementation should submit the OnStatusChangedListener.STATUS event accordingly.