ArcGISTiledLayer Class

  • ArcGISTiledLayer
  • class Esri::ArcGISRuntime::ArcGISTiledLayer

    A layer that can visualize data from an ArcGIS map service or a local TileCache by using previously generated tiles. More...

    Header: #include <ArcGISTiledLayer.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::ImageTiledLayer, Esri::ArcGISRuntime::ApiKeyResource, and Esri::ArcGISRuntime::RemoteResource

    Public Functions

    ArcGISTiledLayer(const QUrl &url, QObject *parent = nullptr)
    ArcGISTiledLayer(const QUrl &url, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
    ArcGISTiledLayer(Esri::ArcGISRuntime::Item *item, QObject *parent = nullptr)
    ArcGISTiledLayer(Esri::ArcGISRuntime::TileCache *tileCache, QObject *parent = nullptr)
    virtual ~ArcGISTiledLayer() override
    Esri::ArcGISRuntime::ArcGISMapServiceInfo mapServiceInfo() const
    quint64 refreshInterval() const
    void setRefreshInterval(quint64 milliseconds)
    Esri::ArcGISRuntime::TileCache *tileCache() const
    QList<Esri::ArcGISRuntime::ArcGISSublayer *> tiledSublayers() const

    Reimplemented Public Functions

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

    Detailed Description

    ArcGIS tiled layers consume image tiles provided by an ArcGIS map service or a local tile package. Raster tiles are cached at various scales when the map service is created. This API requests the tiles needed at a particular map extent. ArcGISTiledLayer will display data from an ArcGIS MapServer if "Single Fused Map Cache" is set to true in its ArcGIS REST Services Directory.

    You can use the ExportTileCacheTask class to generate and download tiles from the service, creating a tile package (.tpk/.tpkx) for use locally on the device. Alternatively, you can use ArcGIS Pro to create a map tile package and provision it to the device.

    Functional characteristics

    ArcGIS tiled layers do not support reprojection, query, select, identify, or editing.

    Performance characteristics

    Tiled image layers (those that derive functionality from the ImageTiledLayer class) provide fast display of geographic imagery stored in raster files. These rasters typically contain image data acquired from satellite, aircraft, or drones. The resolution of such imagery can be very high, providing a detailed view. With increased resolution comes increased file sizes and potentially slower performance.

    Raster tiling is a process that resamples the pixel size at different scales to create images with the appropriate resolution for each scale. The tiling process creates level-of-detail pyramids to efficiently manage how much detail you see as you zoom in and out on the map. Typically, as you zoom closer to the Earth's surface, you want to see greater detail of the geographic information. Tiled image layers allow you to see just the information you need very quickly based on the level-of-detail pyramid at a particular scale, rather than having to load a single large image at once.

    Tiles are generated by the server when the service is created. Requests for tiles are made on multiple threads and handled asynchronously. The size of each returned tile increases as the resolution or complexity of the image in the tile increases. For example, high-resolution imagery tiles can be result in larger file sizes than topographic mapping for the same area and map extent.

    Example:

    Create an ArcGISTiledLayer from a URL to the REST endpoint of an tiled map service:

    // create a new tiled layer
    ArcGISTiledLayer* tiledLayer = new ArcGISTiledLayer(QUrl("https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer"), this);
    // create a new basemap instance with the tiled layer
    Basemap* basemap = new Basemap(tiledLayer, this);
    // create a new map instance
    m_map = new Map(basemap, this);
    // set map on the map view
    m_mapView->setMap(m_map);

    Alternatively, you can display tiles offline by creating an ArcGISTiledLayer from a local tile package (*.tpk):

    TileCache* tileCache = new TileCache(m_dataPath + "tpkx/SanFrancisco.tpkx", this);
    ArcGISTiledLayer* tiledLayer = new ArcGISTiledLayer(tileCache, this);
    Basemap* basemap = new Basemap(tiledLayer, this);
    m_map = new Map(basemap, this);

    See sample: ArcGIS tiled layer (URL)

    See also Layer, ImageTiledLayer, https://developers.arcgis.com/qt/cpp/sample-code/arcgis-tiled-layer/, and https://developers.arcgis.com/qt/cpp/sample-code/export-tiles/.

    Member Function Documentation

    [explicit] ArcGISTiledLayer::ArcGISTiledLayer(const QUrl &url, QObject *parent = nullptr)

    Creates an ArcGIS tiled layer from the specified URL.

    • url - The URL to the REST endpoint of an ArcGIS map service or ArcGIS map service portal item, or the path to a local tile package(.tpk/.tpkx).
    • parent - The optional parent QObject.

    If the specified URL is a map service URL, the MapServer must have "Single Fused Map Cache" set to true in its ArcGIS REST Services Directory. If the specified URL is a portal item URL, the underlying PortalItem is created and can be accessed through Layer::item. See PortalItem::PortalItem(const QUrl&, QObject*) for the supported URL formats.

    See also PortalItem, PortalItem::PortalItem(const QUrl&, QObject*), and Layer::item.

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

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

    Credential are applied if the provided URL is to a secured service.

    [explicit] ArcGISTiledLayer::ArcGISTiledLayer(Esri::ArcGISRuntime::Item *item, QObject *parent = nullptr)

    Creates an ArcGIS tiled layer from a PortalItem representing an ArcGIS map service.

    The item's type should be PortalItemType::MapService.

    See also Layer::item.

    [explicit] ArcGISTiledLayer::ArcGISTiledLayer(Esri::ArcGISRuntime::TileCache *tileCache, QObject *parent = nullptr)

    Creates an ArcGIS Tiled Layer object from a local cache of previously rendered map tiles.

    • tileCache - A tile cache.
    • parent - The optional parent QObject.

    [override virtual] ArcGISTiledLayer::~ArcGISTiledLayer()

    Destructor.

    [override virtual, since Esri::ArcGISRuntime 100.10] QString ArcGISTiledLayer::apiKey() const

    Reimplements: ApiKeyResource::apiKey() const.

    Returns the API key allows your app to access ArcGIS location services and private portal items.

    An API key is a unique long-lived access token that is used to authenticate and monitor requests to ArcGIS location services and private portal items. You can create and manage an API key using your portal when you sign in with an ArcGIS Location Platform account or an ArcGIS Online account with administrator access or a custom role that has the `Generate API keys` privilege. To learn how to create and manage API keys, go to the Create an API Key tutorial. You must ensure that your API key has the correct privileges to access secure resources.

    Note: An API key created with a referrer is not supported. If you need service requests to include the referrer, use the SDK's functionality to intercept the request and add an HTTP referer header.

    In addition to setting an ArcGISRuntimeEnvironment::apiKey at a global level for your application, you can set it on any class that implements ApiKeyResource. This overrides the ArcGISRuntimeEnvironment::apiKey and enables more granular usage telemetry and management of ArcGIS location resources used by your app.

    Classes that expose an API key property by implementing ApiKeyResource include:

    For more information, see API key authentication and Types of authentication.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also setApiKey().

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

    Reimplements: RemoteResource::credential() const.

    Returns the security credential used to access the tiled service.

    The credential is available if the service is secured.

    Esri::ArcGISRuntime::ArcGISMapServiceInfo ArcGISTiledLayer::mapServiceInfo() const

    Returns the ArcGIS map service information.

    This information is available after the layer has successfully loaded.

    [since Esri::ArcGISRuntime 100.1] quint64 ArcGISTiledLayer::refreshInterval() const

    Returns the refresh interval used by the layer, in milliseconds.

    Layers request tiles from the service each time this interval elapses.

    A value of 0 means to never refresh.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also setRefreshInterval().

    [override virtual, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::RequestConfiguration ArcGISTiledLayer::requestConfiguration() const

    Reimplements: RemoteResource::requestConfiguration() const.

    Returns the RequestConfiguration in use by this layer.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also setRequestConfiguration().

    [override virtual, since Esri::ArcGISRuntime 100.10] void ArcGISTiledLayer::setApiKey(const QString &apiKey)

    Reimplements: ApiKeyResource::setApiKey(const QString &apiKey).

    Sets the API key to apiKey. See ApiKeyResource.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also apiKey().

    [since Esri::ArcGISRuntime 100.1] void ArcGISTiledLayer::setRefreshInterval(quint64 milliseconds)

    Sets the refresh interval used by the layer to milliseconds.

    Layers request tiles from the service each time this interval elapses.

    A value of 0 means to never refresh.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also refreshInterval().

    [override virtual, since Esri::ArcGISRuntime 100.1] void ArcGISTiledLayer::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration)

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

    Sets requestConfiguration used for network requests sent by this layer.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also requestConfiguration().

    Esri::ArcGISRuntime::TileCache *ArcGISTiledLayer::tileCache() const

    Returns the local tiled cache.

    This property is populated if the ArcGISTiledLayer has been loaded from a local tile package (.tpk/.tpkx).

    {ArcGISTiledLayer(Esri::ArcGISRuntime::TileCache*, QObject*)}

    See also Esri::ArcGISRuntime::ArcGISTiledLayer::ArcGISTiledLayer(Esri::ArcGISRuntime::TileCache*, QObject*).

    QList<Esri::ArcGISRuntime::ArcGISSublayer *> ArcGISTiledLayer::tiledSublayers() const

    Gets a list of sublayers contained in the service.

    See also ArcGISTiledSublayer and ArcGISSublayer.

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

    Reimplements: RemoteResource::url() const.

    Returns the URL for the endpoint of an ArcGIS map service or the path to a local tile package (.tpk/.tpkx) file.

    The URL is available after the layer has successfully loaded.

    See also ArcGISTiledLayer(const QUrl&, QObject*).

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