ExportTileCacheTask Class

.tpk or .tpkx). Use this in conjunction with a map or image service to generate and download tile packages."> ExportTileCacheTask Class | ArcGISQtCpp
  • ExportTileCacheTask
  • class Esri::ArcGISRuntime::ExportTileCacheTask

    A task used to export a tile cache (.tpk or .tpkx). Use this in conjunction with a map or image service to generate and download tile packages. More...

    Header: #include <ExportTileCacheTask.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Object, Esri::ArcGISRuntime::ApiKeyResource, Esri::ArcGISRuntime::Loadable, and Esri::ArcGISRuntime::RemoteResource

    Public Functions

    ExportTileCacheTask(const QUrl &url, QObject *parent = nullptr)
    ExportTileCacheTask(const QUrl &url, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
    virtual ~ExportTileCacheTask() override
    QFuture<Esri::ArcGISRuntime::ExportTileCacheParameters> createDefaultExportTileCacheParametersAsync(const Esri::ArcGISRuntime::Geometry &areaOfInterest, double minScale, double maxScale)
    Esri::ArcGISRuntime::EstimateTileCacheSizeJob *estimateTileCacheSize(const Esri::ArcGISRuntime::ExportTileCacheParameters &parameters)
    Esri::ArcGISRuntime::ExportTileCacheJob *exportTileCache(const Esri::ArcGISRuntime::ExportTileCacheParameters &parameters, const QString &downloadFilePath)
    Esri::ArcGISRuntime::ArcGISMapServiceInfo mapServiceInfo() const

    Reimplemented Public Functions

    virtual QString apiKey() const override
    virtual void cancelLoad() override
    virtual Esri::ArcGISRuntime::Credential *credential() const override
    virtual void load() override
    virtual Esri::ArcGISRuntime::Error loadError() const override
    virtual Esri::ArcGISRuntime::LoadStatus loadStatus() const override
    virtual Esri::ArcGISRuntime::RequestConfiguration requestConfiguration() const override
    virtual void retryLoad() override
    virtual void setApiKey(const QString &apiKey) override
    virtual void setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration) override
    virtual QUrl url() const override

    Signals

    void doneLoading(const Esri::ArcGISRuntime::Error &loadError)
    void loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Detailed Description

    This task can be used to download tiles (as a tile package, .tpk file) from supporting tiled ArcGIS map or image services. To check if the service supports this, check the list of supported operations on the service's REST endpoint for "EstimateExportTilesSize" and "ExportTiles". If these are not present, they need to be enabled from the server side before you can export tiles from the service. The service could be hosted in the cloud on ArcGIS Online or on-premises with ArcGIS Server.

    To confirm whether a map or image service supports exporting tiles, check:

    See TileCache for information on creating a layer from a local tile cache.

    When using Esri provided image basemaps (such as the World Imagery basemap, see BasemapStyle::ArcGISImagery) an alternative service that supports exporting tiles may be used instead. For example, the World Imagery Service https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer will be exported using a corresponding export-enabled service (https://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Imagery/MapServer).

    Similarly, when using Esri provided elevation data (such as Terrain 3D), an alternative service that supports exporting tiles may be used instead. For example, the Terrain 3D (https://elevation3d.arcgis.com/ArcGIS/rest/services/WorldElevation3D/Terrain3D/ImageServer) will be exported using a corresponding export-enabled service (https://tiledbasemaps.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer). The resulting tile cache can then be used to create an offline ArcGISTiledElevationSource in a scene.

    Note that these export-enabled services are not intended for use as an online basemap or elevation source, and should only be used for exporting tiles for offline use. The export enabled services require authentication to export tiles.

    {ExportTileCacheTask(const QUrl&, QObject*)}, {Esri::ArcGISRuntime::CacheStorageFormat} {CacheStorageFormat}

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

    Member Function Documentation

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

    Create an export tile cache task from a URL.

    • url - The URL of an ArcGIS REST service that supports tile cache export.
    • parent - The optional parent QObject.

    The map or image service must support tile cache export.

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

    Constructs an ExportTileCacheTask with a url to a secure tiled ArcGIS map service, a credential, and an optional parent.

    [override virtual] ExportTileCacheTask::~ExportTileCacheTask()

    Destructor.

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

    Reimplements: ApiKeyResource::apiKey() const.

    Returns the API key to access API key enabled services and resources in ArcGIS Online.

    An API key is a unique key used to authorize access to specific services and resources in ArcGIS Online. It is also used to monitor access to those services. An API key is created and managed in the ArcGIS developer dashboard and is tied to a specific ArcGIS account.

    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:

    See ApiKeyResource.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also setApiKey().

    [override virtual] void ExportTileCacheTask::cancelLoad()

    Reimplements: Loadable::cancelLoad().

    Cancels loading metadata for the object.

    Cancels loading the metadata if the object is loading.

    See Loadable.

    [since Esri::ArcGISRuntime 200.2] QFuture<Esri::ArcGISRuntime::ExportTileCacheParameters> ExportTileCacheTask::createDefaultExportTileCacheParametersAsync(const Esri::ArcGISRuntime::Geometry &areaOfInterest, double minScale, double maxScale)

    Returns the properly initialized {Esri::ArcGISRuntime::ExportTileCacheParameters} {ExportTileCacheParameters} for exporting tiles.

    • areaOfInterest - A Geometry specifying the area to be exported. Must be non-empty.
    • minScale - The map scale '1:min_scale' which determines how far out to take offline. Can be 0 for the furthest out.
    • maxScale - The map scale '1:max_scale' which determines how far in to take offline. Can be 0 for the closest in the service allows.

    This function is asynchronous because it makes use of the service metadata to build a ExportTileCacheParameters object. Calling the function will trigger load of the ExportTileCacheTask, unless it's already loaded.

    The supported geometry types for the area of interest are Envelope and Polygon. The area of interest must have a spatial reference. When a Polygon is supplied, tiles will be filtered according to the polygon geometry, which can help reduce the size of the resulting tile package. Note that the filtered set of tiles may vary, depending on the underlying service.

    The value of min_scale must be larger than the value of max_scale, unless they are 0. A min_scale value of 0 will result in this method choosing the services smallest level number, typically level 0.

    Similarly, a max_scale of 0 will result in the services largest level number being used, representing the closest in view being visible when taken offline. If min_scale is between the scales of tile levels the previous smallest level is used.

    If max_scale is between tile levels the next level is taken to ensure it is displayed. For example a simple service has 4 levels: level 0 scale 2000000; level 1 scale 1000000; level 2 scale 500000; level 3 scale 250000.

    A min_scale of 0 and max_scale of 0 selects all levels 0,1,2,3.

    A min_scale of 750000 (between levels 1 and 2) and a max_scale of 25000 (at level 3) will select levels 1,2,3.

    A min_scale of 0 and a max_scale 750000 (between 1 and 2) will select levels 0,1,2.

    A min_scale of 1000000 and a max_scale of 0 will select all levels from 1 onwards 1,2,3.

    Be careful when combining a large extent or a wide range of scales, this can result in the export failing due to exceeding the services maximum export tile count.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    This function was introduced in Esri::ArcGISRuntime 200.2.

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

    Reimplements: RemoteResource::credential() const.

    Returns the security credential used to access the tiled ArcGIS map Service.

    This is only applicable if using a service that is secured.

    [signal] void ExportTileCacheTask::doneLoading(const Esri::ArcGISRuntime::Error &loadError)

    Signal emitted when this object is done loading.

    • loadError - Details about any error that may have occurred.

    Note: If there is a load error it will also be emitted on the errorOccurred signal.

    See also Loadable and Object.

    Esri::ArcGISRuntime::EstimateTileCacheSizeJob *ExportTileCacheTask::estimateTileCacheSize(const Esri::ArcGISRuntime::ExportTileCacheParameters &parameters)

    Returns a job that can be used to get a size estimate of the tile package contaning tiles specified by the parameters.

    An EstimateTileCacheSizeJob, representing the progress on the server, is returned. The result of the job will be of type EstimateTileCacheSizeResult, which will describe the estimated size and number of tiles.

    Note: The job is initially in the JobStatus::NotStarted state. It can be started by calling Job::start(). The job should be deleted after completion.

    See also Job.

    Esri::ArcGISRuntime::ExportTileCacheJob *ExportTileCacheTask::exportTileCache(const Esri::ArcGISRuntime::ExportTileCacheParameters &parameters, const QString &downloadFilePath)

    Returns a job that can be used to download a tile package from an ArcGIS map or image service.

    • parameters. Export tile cache parameters to be used in exporting.
    • downloadFilePath. Downloaded tile cache file path that ends with .tpk or .tpkx, depending on the desired format.

    The extent, image compression, and other characteristics of the output tile package are determined by the supplied parameters. The tile package will be downloaded to the location specified in the downloadFilePath.

    The resulting job will export tiles from the service, which is referenced by the url property (or its export-enabled alternative), to a local tile cache at the downloadFilePath. The format of the tile cache is determined by the file extension supplied in the downloadFilePath parameter.

    • If the download file path ends with ".tpk", the tile cache will use the legacy compact format.
    • If the download file path ends with ".tpkx", the tile cache will use the current compact version 2 format.

    If the service does not support exporting tiles, the job will fail with an error code of 7007.

    If a .tpkx format was requested, but the format is not supported by the service, the job will fail with an error code of 7024.

    A ExportTileCacheJob, representing the progress on the server, is returned. The result of the job will be of type TileCache, which can be used to create an ArcGISTiledLayer.

    Note: The job is initially in the JobStatus::NotStarted state. It can be started by calling Job::start(). The job should be deleted after completion.

    See also Job.

    [override virtual] void ExportTileCacheTask::load()

    Reimplements: Loadable::load().

    Loads the metadata for the object asynchronously.

    Loads the metadata if the object is not loaded

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::Error ExportTileCacheTask::loadError() const

    Reimplements: Loadable::loadError() const.

    Returns the load error.

    See Loadable.

    See also Error.

    [override virtual] Esri::ArcGISRuntime::LoadStatus ExportTileCacheTask::loadStatus() const

    Reimplements: Loadable::loadStatus() const.

    Returns the load status.

    See Loadable.

    See also LoadStatus.

    [signal] void ExportTileCacheTask::loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Signal emitted when the load status changes for this object.

    See also Loadable.

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

    Returns the task's ArcGISMapServiceInfo

    If created with a URL, this property will be populated after the task has been loaded. Before then, empty will be returned.

    In the case of Esri provided image basemaps or elevation sources, the meta-data will be for the export-enabled version of the service.

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

    Reimplements: RemoteResource::requestConfiguration() const.

    Returns the RequestConfiguration in use by this task.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also setRequestConfiguration().

    [override virtual] void ExportTileCacheTask::retryLoad()

    Reimplements: Loadable::retryLoad().

    Loads or retries loading metadata for the object asynchronously.

    Will retry loading the metadata if the object is failed to load. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded.

    See Loadable.

    [override virtual, since Esri::ArcGISRuntime 100.10] void ExportTileCacheTask::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().

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

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

    Sets configuration parameters used for network requests sent by this task to requestConfiguration.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also requestConfiguration().

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

    Reimplements: RemoteResource::url() const.

    Returns the task's service URL.

    This property is only writable when the task is in load status LoadStatus::NotLoaded.

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