WmtsLayer Class

  • WmtsLayer
  • class Esri::ArcGISRuntime::WmtsLayer

    A layer that can visualize data from a WMTS service by using pre-generated tiles. More...

    Header: #include <WmtsLayer.h>
    Since: Esri::ArcGISRuntime 100.1
    Inherits: Esri::ArcGISRuntime::ImageTiledLayer and Esri::ArcGISRuntime::RemoteResource

    Public Functions

    WmtsLayer(const QUrl &url, const QString &wmtsLayerId, QObject *parent = nullptr)
    WmtsLayer(const QUrl &url, const QString &wmtsLayerId, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
    WmtsLayer(const QUrl &url, const QString &wmtsLayerId, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, QObject *parent = nullptr)
    WmtsLayer(const QUrl &url, const QString &wmtsLayerId, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
    WmtsLayer(const QUrl &url, const QString &wmtsLayerId, const QString &tileMatrixSetId, QObject *parent = nullptr)
    WmtsLayer(const QUrl &url, const QString &wmtsLayerId, const QString &tileMatrixSetId, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
    WmtsLayer(const QUrl &url, const QString &wmtsLayerId, const QString &tileMatrixSetId, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, QObject *parent = nullptr)
    WmtsLayer(const QUrl &url, const QString &wmtsLayerId, const QString &tileMatrixSetId, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
    WmtsLayer(const Esri::ArcGISRuntime::WmtsLayerInfo &layerInfo, QObject *parent = nullptr)
    WmtsLayer(const Esri::ArcGISRuntime::WmtsLayerInfo &layerInfo, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, QObject *parent = nullptr)
    WmtsLayer(const Esri::ArcGISRuntime::WmtsLayerInfo &layerInfo, const Esri::ArcGISRuntime::WmtsTileMatrixSet &tileMatrixSet, QObject *parent = nullptr)
    WmtsLayer(const Esri::ArcGISRuntime::WmtsLayerInfo &layerInfo, const Esri::ArcGISRuntime::WmtsTileMatrixSet &tileMatrixSet, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, QObject *parent = nullptr)
    virtual ~WmtsLayer() override
    QMap<QString, QString> customParameters() const
    Esri::ArcGISRuntime::WmtsLayerInfo layerInfo() const
    Esri::ArcGISRuntime::TileImageFormat preferredImageFormat() const
    void setCustomParameters(const QMap<QString, QString> &customParameters)
    Esri::ArcGISRuntime::WmtsTileMatrixSet tileMatrixSet() const
    QString tileMatrixSetId() const
    QString wmtsLayerId() const

    Reimplemented Public Functions

    virtual Esri::ArcGISRuntime::Credential *credential() const override
    virtual Esri::ArcGISRuntime::RequestConfiguration requestConfiguration() const override
    virtual void setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration) override
    virtual QUrl url() const override

    Detailed Description

    Web Map Tile Service (WMTS) is an Open Geospatial Consortium (OGC) standard for delivering geographic data via raster tiles. A WMTS layer uses pre-generated tiles to create a map instead of dynamically generating map images.The service may be hosted in ArcGIS Online, in ArcGIS Enterprise, or in a third party Server. This API supports WMTS 1.0.0.

    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, some WMTS services require that you provide a direct URL to the getCapabilities resource by appending either /1.0.0/WMTSCapabilities.xml or ?service=wmts&amp;request=getCapabilities&amp;version=1.0.0 to the root WMTS URL.

    Performance characteristics

    WMTS layer consumes raster tiles that were previously rendered and cached 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.

    Example: Add a WMTS layer to a map:

    QUrl wmtsUrl("http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS");
    QString layerId = "WorldTimeZones";
    auto* wmtsLayer = new WmtsLayer(wmtsUrl, layerId, parent);
    
    connect(wmtsLayer, &WmtsLayer::doneLoading, parent, [wmtsLayer](const Esri::ArcGISRuntime::Error& loadError)
            {
              if (!loadError.isEmpty())
              {
                qDebug() << loadError.message() << ": " << loadError.additionalMessage();
              }
    
              if (wmtsLayer->loadStatus() != LoadStatus::Loaded)
              {
                return;
              }
    
              // work with WMTS layer here
            });
    
    Map* map = new Map(BasemapStyle::ArcGISImagery, parent);
    map->operationalLayers()->append(wmtsLayer);

    Relevant samples:

    • WMTS layer: Display a layer from a Web Map Tile Service.

    See also Layer.

    Member Function Documentation

    WmtsLayer::WmtsLayer(const QUrl &url, const QString &wmtsLayerId, QObject *parent = nullptr)

    Creates a WMTS layer from the specified URL and layer Id.

    • url - The URL to a WMTS service.
    • wmtsLayerId - The identifier of the WMTS layer.
    • parent - The optional parent QObject.

    See also WmtsLayer.

    WmtsLayer::WmtsLayer(const QUrl &url, const QString &wmtsLayerId, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)

    Constructor that accepts a URL (url), wmtsLayerId, credential and an optional parent.

    • url - The URL of the WMTS service - see WmtsService::url.
    • wmtsLayerId - The ID of the layer - for example obtained from WmtsLayerInfo::wmtsLayerId.
    • credential - The Credential used to access this layer.
    • parent - The parent object for this WmtsLayer (optional).

    See also WmtsLayer.

    WmtsLayer::WmtsLayer(const QUrl &url, const QString &wmtsLayerId, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, QObject *parent = nullptr)

    Creates a WMTS layer from the specified URL, layer Id, and preferred image format.

    • url - The URL to a WMTS service.
    • wmtsLayerId - The identifier of the WMTS layer.
    • preferredImageFormat - The preferred image format of the WMTS layer.
    • parent - The optional parent QObject.

    See also WmtsLayer.

    WmtsLayer::WmtsLayer(const QUrl &url, const QString &wmtsLayerId, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)

    Constructor that accepts a URL (url), wmtsLayerId, preferredImageFormat, credential and an optional parent.

    See also WmtsLayer.

    WmtsLayer::WmtsLayer(const QUrl &url, const QString &wmtsLayerId, const QString &tileMatrixSetId, QObject *parent = nullptr)

    Creates a WMTS layer from the specified URL, layer Id, and tile matrix set Id.

    • url - The URL to a WMTS service.
    • wmtsLayerId - The identifier of the WMTS layer.
    • tileMatrixSetId - The id of the tile matrix set supported by of the WMTS layer.
    • parent - The optional parent QObject.

    See also WmtsLayer.

    WmtsLayer::WmtsLayer(const QUrl &url, const QString &wmtsLayerId, const QString &tileMatrixSetId, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)

    Constructor that accepts a URL (url), wmtsLayerId, tileMatrixSetId, credential and an optional parent.

    See also WmtsLayer.

    WmtsLayer::WmtsLayer(const QUrl &url, const QString &wmtsLayerId, const QString &tileMatrixSetId, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, QObject *parent = nullptr)

    Creates a WMTS layer from the specified URL, layer Id, tile matrix set Id and preferred image format.

    • url - The URL to a WMTS service.
    • wmtsLayerId - The identifier of the WMTS layer.
    • tileMatrixSetId - The id of the tile matrix set supported by of the WMTS layer.
    • preferredImageFormat - The preferred image format of the WMTS layer.
    • parent - The optional parent QObject.

    See also WmtsLayer.

    WmtsLayer::WmtsLayer(const QUrl &url, const QString &wmtsLayerId, const QString &tileMatrixSetId, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)

    Constructor that accepts a URL (url), wmtsLayerId, tileMatrixSetId, preferredImageFormat, credential and an optional parent.

    See also WmtsLayer.

    [explicit] WmtsLayer::WmtsLayer(const Esri::ArcGISRuntime::WmtsLayerInfo &layerInfo, QObject *parent = nullptr)

    Creates a WMTS layer from a WMTS layer information.

    See also WmtsLayer.

    WmtsLayer::WmtsLayer(const Esri::ArcGISRuntime::WmtsLayerInfo &layerInfo, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, QObject *parent = nullptr)

    Creates a WMTS layer from a WMTS layer information and preferred image format.

    • layerInfo - A WmtsLayerInfo.
    • preferredImageFormat - The preferred image format of the WMTS layer.
    • parent - The optional parent QObject.

    See also WmtsLayer.

    WmtsLayer::WmtsLayer(const Esri::ArcGISRuntime::WmtsLayerInfo &layerInfo, const Esri::ArcGISRuntime::WmtsTileMatrixSet &tileMatrixSet, QObject *parent = nullptr)

    Creates a WMTS layer from a WMTS layer information and tile matrix set Id.

    See also WmtsLayer.

    WmtsLayer::WmtsLayer(const Esri::ArcGISRuntime::WmtsLayerInfo &layerInfo, const Esri::ArcGISRuntime::WmtsTileMatrixSet &tileMatrixSet, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, QObject *parent = nullptr)

    Creates a WMTS layer from the WMTS layer information, tile matrix set Id and preferred image format.

    • layerInfo - A WmtsLayerInfo.
    • tileMatrixSet - A WmtsTileMatrix.
    • preferredImageFormat - The preferred image format of the WMTS layer.
    • parent - The optional parent QObject.

    See also WmtsLayer.

    [override virtual] WmtsLayer::~WmtsLayer()

    Destructor.

    [override virtual] Esri::ArcGISRuntime::Credential *WmtsLayer::credential() const

    Reimplements: RemoteResource::credential() const.

    Returns security credentials to access the remote resource. Only applicable if the resource is secured.

    [since Esri::ArcGISRuntime 100.6] QMap<QString, QString> WmtsLayer::customParameters() const

    Returns the dictionary of custom parameters to be sent with WMTS requests issued by this layer.

    These parameters are appended to GetMap and GetFeatureInfo requests. If a parameter with the same name is defined in WmtsService::customParameters, then layer-specific values take precedence over service-wide values.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also setCustomParameters().

    Esri::ArcGISRuntime::WmtsLayerInfo WmtsLayer::layerInfo() const

    Returns the WMTS Layer information.

    Esri::ArcGISRuntime::TileImageFormat WmtsLayer::preferredImageFormat() const

    Returns the preferred image format used for tiles of this WMTS layer.

    If an image format is not specified when creating this layer, then the value is TileImageFormat::Unknown until the layer is loaded.

    [override virtual] Esri::ArcGISRuntime::RequestConfiguration WmtsLayer::requestConfiguration() const

    Reimplements: RemoteResource::requestConfiguration() const.

    Returns the RequestConfiguration in use by this layer.

    See also setRequestConfiguration().

    [since Esri::ArcGISRuntime 100.6] void WmtsLayer::setCustomParameters(const QMap<QString, QString> &customParameters)

    Sets the customParameters to customParameters.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also customParameters.

    [override virtual] void WmtsLayer::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration)

    Reimplements: RemoteResource::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration).

    Sets requestConfiguration used for network requests sent by this layer.

    See also requestConfiguration().

    Esri::ArcGISRuntime::WmtsTileMatrixSet WmtsLayer::tileMatrixSet() const

    Returns the WMTS tile matrix set for this WMTS layer.

    If tile matrix set is not specified when creating this layer, or is specified only by name, then the value is empty until the layer is loaded.

    QString WmtsLayer::tileMatrixSetId() const

    Returns the tile matrix set identifier for this WMTS layer.

    If tile matrix set is not specified when creating this layer, or is specified only by name, then the value is empty until layer is loaded.

    [override virtual] QUrl WmtsLayer::url() const

    Reimplements: RemoteResource::url() const.

    Returns the URL of the WMTS service.

    This value cannot be changed on loaded layers, or on layers created from a WmtsLayerInfo.

    {WmtsLayer(const QUrl&, const QString&, QObject*)}

    See also Esri::ArcGISRuntime::WmtsLayer::WmtsLayer(const QUrl&, const QString&, QObject*).

    QString WmtsLayer::wmtsLayerId() const

    Returns the id of the WMTS layer.

    layerId cannot be changed on loaded layers, or on layers created from a WmtsLayerInfo.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.