WmtsLayer Class

  • WmtsLayer
  • class Esri::ArcGISRuntime::WmtsLayer

    Defines an Open Geospatial Consortium (OGC) Web Map Tile Service (WMTS) layer. More...

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

    This class was introduced in Esri::ArcGISRuntime 100.1.

    Public Functions

    WmtsLayer(const Esri::ArcGISRuntime::WmtsLayerInfo &layerInfo, const Esri::ArcGISRuntime::WmtsTileMatrixSet &tileMatrixSet, 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, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, QObject *parent = nullptr)
    WmtsLayer(const Esri::ArcGISRuntime::WmtsLayerInfo &layerInfo, 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 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::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, Esri::ArcGISRuntime::TileImageFormat preferredImageFormat, 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::Credential *credential, QObject *parent = nullptr)
    WmtsLayer(const QUrl &url, const QString &wmtsLayerId, 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

    An instance of this class lets you display data from a WMTS service by using pre-generated tiles. A WmtsLayer uses pre-generated tiles to create a map instead of dynamically generating map images.

    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.

    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 WMTS layer from URL

    For some WMTS services it may be necessary to 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.

    WmtsLayer adopts the loadable pattern; many of its properties are initialized asynchronously. See Loadable for more information. The layer is loaded when displayed in a MapView or a SceneView. If using the layer without a MapView or a SceneView, call the load method. Use the layer doneLoading signal to determine when the layer is ready, and check the loadStatus before using the layer.

    Example: Add a WMTS layer to a map:

    QUrl wmtsUrl("http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/WMTS");
    QString layerId = "WorldTimeZones";
    WmtsLayer* wmtsLayer = new WmtsLayer(wmtsUrl, layerId, parent);
    
    connect(wmtsLayer, &WmtsLayer::doneLoading, parent, [wmtsLayer](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(Basemap::imageryWithLabels(parent), parent);
    map->operationalLayers()->append(wmtsLayer);

    See sample: {https://developers.arcgis.com/qt/v100/cpp/sample-code/wmts-layer/} {WMTS layer}

    See also WmtsServiceInfo, Layer, ImageTiledLayer, and Loadable.

    Member Function Documentation

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

    Constructor that accepts a layerInfo, tileMatrixSet, preferredImageFormat and an optional parent.

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

    Constructor that accepts a layerInfo, tileMatrixSet and an optional parent.

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

    Constructor that accepts a layerInfo, preferredImageFormat and an optional parent.

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

    Constructor that accepts a layerInfo and an optional parent.

    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.

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

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

    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.

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

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

    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.

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

    Constructor that accepts a URL, WTMS layer ID, and preferred image format.

    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).

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

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

    [override virtual] WmtsLayer::~WmtsLayer()

    Destructor.

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

    Reimplements: RemoteResource::credential() const.

    Returns the Credential to be used by the network resource in the event of an authentication challenge.

    The default credential is a nullptr.

    QMap<QString, QString> WmtsLayer::customParameters() const

    Returns custom parameters to append to GetTile requests.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also setCustomParameters.

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

    Returns the layer info.

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

    Returns the preferred image format.

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

    Reimplements: RemoteResource::requestConfiguration() const.

    Returns the RequestConfiguration in use by this layer.

    See also setRequestConfiguration().

    void WmtsLayer::setCustomParameters(const QMap<QString, QString> &customParameters)

    Sets customParameters to append to GetTile requests.

    If a parameter with the same name is defined in a layer's custom parameters, then layer-specific values take precedence over service-wide values.

    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 tile matrix set.

    QString WmtsLayer::tileMatrixSetId() const

    Returns the ID of the tile matrix set used for this layer.

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

    Reimplements: RemoteResource::url() const.

    Returns the URL of the WMTS layer.

    QString WmtsLayer::wmtsLayerId() const

    Returns the layer ID that was used to construct this layer.

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