Class WmtsLayer

  • All Implemented Interfaces:
    RemoteResource, LayerContent, Loadable

    public final class WmtsLayer
    extends ImageTiledLayer
    implements RemoteResource
    Displays data from a WMTS service by using pre-generated tiles.

    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.

    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.

    Creating a WTMS layer 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.

    Example for working with WMTS layer

     final WmtsLayer wmtsLayer = new WmtsLayer(
               "", "WorldTimeZones");
     wmtsLayer.addDoneLoadingListener(() -> {
       if (wmtsLayer.getLoadStatus() == LoadStatus.LOADED) {
         // work with WMTS layer here
    The layer is loaded when displayed in a MapView or a SceneView; if using the layer without a MapView or a SceneView, call the Layer.loadAsync() method. Use the layer done loading event to determine when the layer is ready, and check the loaded status before using the layer.

    See Also:
    Layer, ImageTiledLayer, WmtsService, WmtsServiceInfo, WmtsLayerInfo, WmtsTileMatrixSet, Layer
    • Method Detail

      • copy

        public WmtsLayer copy()
        Creates a deep copy of this WmtsLayer instance.
        a deep copy of this WmtsLayer instance, which means that copies of all fields of this layer are made including its loading state
      • getPreferredImageFormat

        public TileInfo.ImageFormat getPreferredImageFormat()
        Gets the preferred image format.

        Note that this will return the value you specified in the constructor, not necessarily what the service returned.

        the preferred image format
      • getLayerInfo

        public WmtsLayerInfo getLayerInfo()
        Gets the layer info.
        the layer info
      • getLayerId

        public String getLayerId()
        Gets the layer ID that was used to construct this layer.
        the layer ID that was used to construct this layer
      • getTileMatrixSet

        public WmtsTileMatrixSet getTileMatrixSet()
        Gets the tile matrix set.
        the tile matrix set
      • getCustomParameters

        public Map<String,​String> getCustomParameters()
        Gets a Map containing custom parameters that are applied to all GetTile requests related to this layer. Modify this Map to change the parameters that are used. If a parameter with the same name is defined in the service's custom parameters, then layer-specific values take precedence over service-wide values.
        a modifiable Map; the keys are parameters names and the values are parameters values
      • setCredential

        public void setCredential​(Credential credential)
        Description copied from interface: RemoteResource
        Sets a Credential to be used by the network-enabled resource in the event of an authentication challenge. The default credential is null.
        Specified by:
        setCredential in interface RemoteResource
        credential - the Credential to be used for authentication
      • getUri

        public String getUri()
        Gets the URL of the WMTS layer.
        Specified by:
        getUri in interface RemoteResource
        the URL of the WMTS layer
      • getTile

        protected byte[] getTile​(TileKey tileKey)
        Description copied from class: ImageTiledLayer
        Gets the encoded bytes that represents a tile for the given tile key. The encoding must match TileInfo specified in the constructor ImageTiledLayer(TileInfo, Envelope).
        Specified by:
        getTile in class ImageTiledLayer
        tileKey - key for the expected tile
        the encoded bytes that represent the tile for the given tile key