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 |
This class was introduced in Esri::ArcGISRuntime 100.0.
Public Functions
ExportTileCacheTask(const QUrl &url, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr) | |
ExportTileCacheTask(const QUrl &url, QObject *parent = nullptr) | |
virtual | ~ExportTileCacheTask() override |
Esri::ArcGISRuntime::TaskWatcher | createDefaultExportTileCacheParameters(const Esri::ArcGISRuntime::Geometry &areaOfInterest, double minScale, double maxScale) |
Esri::ArcGISRuntime::EstimateTileCacheSizeJob * | estimateTileCacheSize(const Esri::ArcGISRuntime::ExportTileCacheParameters ¶meters) |
Esri::ArcGISRuntime::ExportTileCacheJob * | exportTileCache(const Esri::ArcGISRuntime::ExportTileCacheParameters ¶meters, 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 | defaultExportTileCacheParametersCompleted(QUuid taskId, Esri::ArcGISRuntime::ExportTileCacheParameters defaultExportTileCacheParameters) |
void | doneLoading(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:
- ArcGISMapServiceInfo::isExportTilesAllowed property for the legacy compact format (.tpk).
- ArcGISMapServiceInfo::isExportTileCacheCompactV2Allowed property for the compact version 2 format (
.tpkx
).
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.
Member Function Documentation
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.
ExportTileCacheTask::ExportTileCacheTask (const QUrl &url, QObject *parent = nullptr)
Constructs an ExportTileCacheTask with a url to a tiled ArcGIS map service and an optional parent.
[signal]
void ExportTileCacheTask::defaultExportTileCacheParametersCompleted (QUuid taskId , Esri::ArcGISRuntime::ExportTileCacheParameters defaultExportTileCacheParameters )
Signal emitted when createDefaultExportTileCacheParameters completes.
- taskId - The task ID that this signal corresponds to
- defaultExportTileCacheParameters - The default ExportTileCacheParameters
See also Loadable.
[signal]
void ExportTileCacheTask::doneLoading (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.
[signal]
void ExportTileCacheTask::loadStatusChanged (Esri::ArcGISRuntime::LoadStatus loadStatus )
Signal emitted when the load status changes for this object.
- loadStatus - The LoadStatus.
See also Loadable.
[override virtual]
ExportTileCacheTask::~ExportTileCacheTask ()
Destructor.
[override virtual]
QString ExportTileCacheTask::apiKey () const
Reimplements: ApiKeyResource::apiKey() const.
Returns the API key. See ApiKeyResource.
This function was introduced in Esri::ArcGISRuntime 100.10.
See also setApiKey().
[override virtual]
void ExportTileCacheTask::cancelLoad ()
Reimplements: Loadable::cancelLoad().
See Loadable.
Esri::ArcGISRuntime::TaskWatcher ExportTileCacheTask::createDefaultExportTileCacheParameters (const Esri::ArcGISRuntime::Geometry &areaOfInterest , double minScale , double maxScale )
A convenience method to get properly initialized parameters for exporting tiles.
It will calculate the levels of detail (LODs) required based on the specified minScale and maxScale and the tiling scheme of the service. The areaOfInterest represents the geographic area for which tiles are needed.
The supported geometry types for the area of interest are Envelope and Polygon. The area of interest must have a spatial reference. Where 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.
[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.
Esri::ArcGISRuntime::EstimateTileCacheSizeJob *ExportTileCacheTask::estimateTileCacheSize (const Esri::ArcGISRuntime::ExportTileCacheParameters ¶meters)
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 ¶meters, 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().
See Loadable.
[override virtual]
Esri::ArcGISRuntime::Error ExportTileCacheTask::loadError () const
Reimplements: Loadable::loadError() const.
See Loadable.
[override virtual]
Esri::ArcGISRuntime::LoadStatus ExportTileCacheTask::loadStatus () const
Reimplements: Loadable::loadStatus() const.
See 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, nullptr
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]
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().
See Loadable.
[override virtual]
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]
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 URL to a tiled ArcGIS Map service.
In the case of Esri provided image basemaps, the meta-data will be for the export-enabled version of the service.