Class WmtsLayer

  • All Implemented Interfaces:
    RemoteResource, LayerContent, Loadable

    public final class WmtsLayer
    extends ImageTiledLayer
    implements RemoteResource
    Defines an Open Geospatial Consortium (OGC) Web Map Tile Service (WMTS) layer.

    Example for working with WMTS layer:

     final WmtsLayer wmtsLayer = new WmtsLayer(
               "http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS?", "WorldTimeZones");
    
     wmtsLayer.addDoneLoadingListener(() -> {
       if (wmtsLayer.getLoadStatus() == LoadStatus.LOADED) {
         // work with WMTS layer here
       }
     });
     map.getOperationalLayers().add(wmtsLayer);
     
    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.

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

      • copy

        public WmtsLayer copy()
        Creates a deep copy of this WmtsLayer instance.
        Returns:
        a deep copy of this WmtsLayer instance, which means that copies of all fields of this layer are made including its loading state
        Since:
        100.1.0
      • 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.

        Returns:
        the preferred image format
        Since:
        100.1.0
      • getLayerInfo

        public WmtsLayerInfo getLayerInfo()
        Gets the layer info.
        Returns:
        the layer info
        Since:
        100.1.0
      • getLayerId

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

        public WmtsTileMatrixSet getTileMatrixSet()
        Gets the tile matrix set.
        Returns:
        the tile matrix set
        Since:
        100.1.0
      • 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.
        Returns:
        a modifiable Map; the keys are parameters names and the values are parameters values
        Since:
        100.6.0
      • setCredential

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

        public Credential getCredential()
        Description copied from interface: RemoteResource
        Gets the Credential that is set on the network resource.
        Specified by:
        getCredential in interface RemoteResource
        Returns:
        the Credential, or null if there is none
      • getRequestConfiguration

        public RequestConfiguration getRequestConfiguration()
        Description copied from interface: RemoteResource
        Gets the RequestConfiguration used to modify the parameters of network requests made by this RemoteResource.
        Specified by:
        getRequestConfiguration in interface RemoteResource
        Returns:
        the RequestConfiguration used to modify network requests
      • getUri

        public String getUri()
        Gets the URL of the WMTS layer.
        Specified by:
        getUri in interface RemoteResource
        Returns:
        the URL of the WMTS layer
        Since:
        100.1.0
      • 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
        Parameters:
        tileKey - key for the expected tile
        Returns:
        the encoded bytes that represent the tile for the given tile key