ArcGIS Runtime SDK for iOS: AGSExportVectorTilesTask Class Reference
ArcGIS Runtime SDK for iOS  100.15
AGSExportVectorTilesTask Class Reference

Description

A task used to export vector tiles and optionally a portal item's vector tile style resources.

Instances of this class represent a task that can be used to download vector tiles and their associated style resources (as a vector tile package, .vtpk file), see AGSVectorTileCache.

A portal item can contain a custom style resources overriding the vector tile services default style and this can be checked with AGSExportVectorTilesTask::hasStyleResources. The custom style is exported separately as an AGSItemResourceCache.

The export vector tiles task can be initialized with a URL using initWithURL: (AGSExportVectorTilesTask).

The URL can be:

  • A vector tile server that ends in "VectorTileServer" and is the rest end-point used to export vector tile packages. The vector tile service must be enabled for export or the task will fail to load.
  • A portal item for a vector tile service or a vector tiled layer with a custom style applied
  • A vector basemap layer created using an AGSBasemapStyle object

Alternatively an AGSPortalItem object referencing a vector tile service or a custom style for a vector tiled layer, can be used with initWithPortalItem: (AGSExportVectorTilesTask).

When using Esri provided vector basemaps that do not support exporting tiles (such as the ArcGIS streets basemap

  • see AGSBasemapStyleArcGISStreets), an alternative service that supports exporting tiles will be used instead.
    Since
    100.2
Inheritance diagram for AGSExportVectorTilesTask:
AGSLoadableRemoteResourceBase <AGSAPIKeyResource> AGSLoadableBase <AGSRemoteResource> AGSObject <AGSLoadable>

Instance Methods

(void) - cancelLoad
 
(id< AGSCancelable >) - defaultExportVectorTilesParametersWithAreaOfInterest:maxScale:completion:
 
(void) - doCancelLoading
 
(void) - doStartLoading:
 
(AGSExportVectorTilesJob *) - exportStyleResourceCacheJobWithDownloadDirectory:
 
(AGSExportVectorTilesJob *) - exportVectorTilesJobWithParameters:downloadFileURL:
 
(AGSExportVectorTilesJob *) - exportVectorTilesJobWithParameters:vectorTileCacheDownloadFileURL:itemResourceCacheDownloadDirectory:
 
(instancetype) - initWithPortalItem:
 
(instancetype) - initWithURL:
 
(void) - loadDidFinishWithError:
 
(void) - loadWithCompletion:
 
(void) - onLoadStatusChanged
 
(void) - retryLoadWithCompletion:
 

Class Methods

(instancetype) + exportVectorTilesTaskWithPortalItem:
 
(instancetype) + exportVectorTilesTaskWithURL:
 

Properties

NSString * APIKey
 
AGSCredentialcredential
 
BOOL hasStyleResources
 
NSError * loadError
 
AGSLoadStatus loadStatus
 
AGSPortalItemportalItem
 
AGSRequestConfigurationrequestConfiguration
 
NSURL * URL
 
AGSVectorTileSourceInfovectorTileSourceInfo
 

Method Documentation

◆ cancelLoad

- (void) cancelLoad
requiredinherited

Cancels loading if it is in progress, otherwise it does nothing. This should be called carefully because other objects could be waiting for loadWithCompletion: or retryLoadWithCompletion: to complete and this will call them all back with the error of NSUserCancelledError

Since
100

◆ defaultExportVectorTilesParametersWithAreaOfInterest:maxScale:completion:

- (id<AGSCancelable>) defaultExportVectorTilesParametersWithAreaOfInterest: (AGSGeometry *)  areaOfInterest
maxScale: (double)  maxScale
completion: (void(^)(AGSExportVectorTilesParameters *__nullable params, NSError *__nullable error))  completion 

A convenience method to get properly initialized parameters for exporting tiles. It will calculate the levels of detail (LODs) required based on the specified max scale and the tiling scheme of the service. Be careful when you provide a large area of interest or a small maximum scale value as this could result in a large number of tiles being requested.

Parameters
areaOfInterestA polygon or envelope geometry representing the geographic area for which tiles are needed. Point and polyline geometries are not supported.
maxScaleThe maximum map scale for which tiles are needed. There won't be any tiles when the map is zoomed in beyond this scale. Set the value to 0 to include all levels of detail in the service.
completionA block that is invoked when the operation is complete with either the results or an error.
Returns
An operation which can be canceled.
Since
100.2

◆ doCancelLoading

- (void) doCancelLoading

Never call this method directly. The framework calls this method on a background thread when cancelLoad (AGSLoadable-p) is called. It is meant to be overriden by subclasses. Subclasses should override this method to cancel loading their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly)) at the end passing in an error representing NSUserCancelledError.

Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ doStartLoading:

- (void) doStartLoading: (BOOL)  retrying

Never call this method directly. The framework calls this method on a background thread when loadWithCompletion: (AGSLoadable-p) or retryLoadWithCompletion: (AGSLoadable-p) is called. It is meant to be overriden by subclasses. Subclasses should override this method to load their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly)) upon completion, passing in the error if any.

Parameters
retryingflag that is true if this method was called from retryLoadWithCompletion: (AGSLoadable-p).
Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ exportStyleResourceCacheJobWithDownloadDirectory:

- (AGSExportVectorTilesJob*) exportStyleResourceCacheJobWithDownloadDirectory: (NSURL *)  downloadDirectory

Returns a job which can be used to separately download any associated custom style resources for the vector tiles. Note, it does not download the vector tiles. This is useful if you want to download the style resources once and then re-use them with multiple tile packages containing only the data tiles which keeps their size to a minimum. Only applicable if hasStyleResources is true indicating that the task's portal item contains style resources.

See also
AGSExportVectorTilesResult::itemResourceCache representing the cache that will contain the custom style resources.
Note
The job is dormant and needs to be explicitly started using startWithStatusHandler:completion: (AGSExportVectorTilesJob)
Parameters
downloadDirectorywhere the cutom style resources will be saved.
Returns
Job representing the progress on the server. The result of the job will be of type AGSExportVectorTilesResult.
Since
100.2

◆ exportVectorTilesJobWithParameters:downloadFileURL:

- (AGSExportVectorTilesJob*) exportVectorTilesJobWithParameters: (AGSExportVectorTilesParameters *)  parameters
downloadFileURL: (NSURL *)  downloadFileURL 

Returns a job which can be used to generate and download a vector tile package containing tiles and the default style resources associated with the service. The result of the job will be of type AGSExportVectorTilesResult. Note, if this task is based on a portal item that has custom style overrides (hasStyleResources = true), the custom style will not be downloaded and as a result the exported vector tiles may look different when viewed in a map. To download the custom styles, consider using exportStyleResourceCacheJobWithDownloadDirectory: or exportVectorTilesJobWithParameters:vectorTileCacheDownloadFileURL:itemResourceCacheDownloadDirectory: .

See also
AGSExportVectorTilesResult::vectorTileCache representing the cache that will contain the vector tiles.
Note
The job is dormant and needs to be explicitly started using startWithStatusHandler:completion: (AGSExportVectorTilesJob).
Parameters
parametersspecifying which tiles to include in the tile package.
downloadFileURLwhere the tile package should be saved on disk, including the desired file name ending with the .vtpk file extension.
Returns
Job representing the progress on the server. The result of the job will be of type AGSExportVectorTilesResult.
Since
100.2

◆ exportVectorTilesJobWithParameters:vectorTileCacheDownloadFileURL:itemResourceCacheDownloadDirectory:

- (AGSExportVectorTilesJob*) exportVectorTilesJobWithParameters: (AGSExportVectorTilesParameters *)  parameters
vectorTileCacheDownloadFileURL: (NSURL *)  vectorTileCacheDownloadFileURL
itemResourceCacheDownloadDirectory: (NSURL *)  itemResourceCacheDownloadDirectory 

Returns a job which can be used to generate and download a vector tile package containing the tiles specified by the parameters. The task portal item's associated style resources will be downloaded and saved separately to itemResourceCacheDownloadDirectory. Only applicable if hasStyleResources is true indicating that the task's portal item contains style resources. The result of the job will be of type AGSExportVectorTilesResult

See also
AGSExportVectorTilesResult::vectorTileCache representing the cache that will contain the vector tiles.
AGSExportVectorTilesResult::itemResourceCache representing the cache that will contain the custom style resources.
Note
The job is dormant and needs to be explicitly started using startWithStatusHandler:completion: (AGSExportVectorTilesJob).
Parameters
parametersspecifying which tiles to include in the tile package.
vectorTileCacheDownloadFileURLwhere the tile package should be saved on disk, including the desired file name ending with the .vtpk file extension.
itemResourceCacheDownloadDirectorywhere the custom style resources will be saved.
Returns
Job representing the progress on the server. The result of the job will be of type AGSExportVectorTilesResult.
Since
100.2

◆ exportVectorTilesTaskWithPortalItem:

+ (instancetype) exportVectorTilesTaskWithPortalItem: (AGSPortalItem *)  portalItem

Creates an export vector tiles task with an item on ArcGIS Online or ArcGIS portal representing an ArcGIS vector tile layer. The item's type must be an AGSPortalItemTypeVectorTileService object or the task will fail to load.

Note
The vector tile service referred to by the item must have the export tiles capability enabled. See AGSVectorTileSourceInfo::exportTilesAllowed.
Parameters
portalItemA portal item representing an ArcGIS vector tile layer.
Returns
A new task.
Since
100.2

◆ exportVectorTilesTaskWithURL:

+ (instancetype) exportVectorTilesTaskWithURL: (NSURL *)  URL

Creates an export vector tiles task with a URL to a vector tile service.

The URL can be:

  • A vector tile server that ends in "VectorTileServer" and is the rest end-point used to export vector tile packages. The vector tile service must be enabled for export or the task will fail to load.
  • A portal item for a vector tile service or a vector tiled layer with a custom style applied
  • A vector basemap layer created using an AGSBasemapStyle object

If the URL represents an AGSPortalItem object that can be used to download vector tiles or style resources, the AGSExportVectorTilesTask::portalItem property will be populated when the task is loaded.

Parameters
URLThe URL of a service or portal item to be used for exporting vector tiles.
Returns
A new task.
Since
100.2

◆ initWithPortalItem:

- (instancetype) initWithPortalItem: (AGSPortalItem *)  portalItem

Creates an export vector tiles task with an item on ArcGIS Online or ArcGIS portal representing an ArcGIS vector tile layer. The item's type must be AGSPortalItemTypeVectorTileService.

Note
The vector tile service referred to by the item must have the export tiles capability enabled. See AGSVectorTileSourceInfo::exportTilesAllowed.
Parameters
portalItemA portal item representing an ArcGIS vector tile layer.
Since
100.2

◆ initWithURL:

- (instancetype) initWithURL: (NSURL *)  URL

Creates an export vector tiles task with a URL to a vector tile service.

The URL can be:

  • A vector tile server that ends in "VectorTileServer" and is the rest end-point used to export vector tile packages. The vector tile service must be enabled for export or the task will fail to load.
  • A portal item for a vector tile service or a vector tiled layer with a custom style applied
  • A vector basemap layer created using an AGSBasemapStyle object

If the URL represents an AGSPortalItem object that can be used to download vector tiles or style resources, the AGSExportVectorTilesTask::portalItem property will be populated when the task is loaded.

Parameters
URLThe URL of a service or portal item to be used for exporting vector tiles.
Since
100.2

◆ loadDidFinishWithError:

- (void) loadDidFinishWithError: (nullable NSError *)  error

Only subclasses should call this method in doStartLoading: (AGSLoadableBase(ForSubclassEyesOnly)) and doCancelLoading (AGSLoadableBase(ForSubclassEyesOnly)) when done loading or failed to load.

Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ loadWithCompletion:

- (void) loadWithCompletion: (nullable void(^)(NSError *__nullable error))  completion
requiredinherited

Loads data for the object asynchronously. The completion block is invoked upon completion.

You can call this method any number of times, however only one attempt is made to load the data. If it is already loading, it will just continue to load (i.e. not force a reload). If it has already loaded successfully, the completion block will be invoked right away. If it has already failed to load, the completion block will be invoked right away with error previously encountered. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.

Parameters
completionblock that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load.
Note
The completion block is always invoked on the main thread.
Since
100
See also
- cancelLoad to cancel loading
- retryLoadWithCompletion: to force reload

◆ onLoadStatusChanged

- (void) onLoadStatusChanged

Never call this method directly. The framework calls this method on a background thread when AGSLoadable::loadStatus changes is called. Subclasses can optionally implement this to know when their loading status has changed.

Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ retryLoadWithCompletion:

- (void) retryLoadWithCompletion: (nullable void(^)(NSError *__nullable error))  completion
requiredinherited

Tries to reload when an object has failed to load. This method should be called judiciously. It should be called when:

  1. you didn't have network connectivity earlier when it failed and you want to retry now that you have connectivity
  2. the server was down earlier when it failed and you want to retry
  3. the request is taking too long and you want to cancel it and retry, in which case you will first call cancelLoad and then this method

If the data hasn't started loading, it will start loading. If it is already loading, it will just continue to load. If it has already loaded successfully, calls back right away. If it has already failed to load, tries again. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.

Parameters
completionblock that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load.
Note
The completion block is always invoked on the main thread.
Since
100

Property Documentation

◆ APIKey

- (NSString*) APIKey
readwriterequirednonatomiccopyinherited

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 API key at a global level for your application using the AGSArcGISRuntimeEnvironment::APIKey property, you can set an AGSAPIKeyResource::APIKey property on any ArcGIS Runtime class that implements AGSAPIKeyResource. When you set an individual AGSAPIKeyResource::APIKey property on an AGSAPIKeyResource it will override the default key at the global level (on the AGSArcGISRuntimeEnvironment::APIKey property, in other words), enabling more granular usage telemetry and management for ArcGIS Online resources used by your app. Classes that expose an API key property by implementing AGSAPIKeyResource include:

◆ credential

- (AGSCredential*) credential
readwritenonatomicstronginherited

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

Since
100

◆ hasStyleResources

- (BOOL) hasStyleResources
readnonatomicassign

Indicates if the task's portal item has any associated style resources. These resources are typically used to override the service's default style.

Note
Use exportStyleResourceCacheJobWithDownloadDirectory: to download the style without any tiles. Use exportVectorTilesJobWithParameters:vectorTileCacheDownloadFileURL:itemResourceCacheDownloadDirectory: to download the style and the tiles.
This is only true if the task has loaded from a portal item and that portal item has associated style resources.
Since
100.2

◆ loadError

- (NSError*) loadError
readnonatomicstronginherited

The error that was encountered during the most recent load operation. Will be nil if the operation succeeded.

Since
100

◆ loadStatus

- (AGSLoadStatus) loadStatus
readrequirednonatomicassigninherited

Status of the load operation.

Since
100

◆ portalItem

- (AGSPortalItem*) portalItem
readnonatomicstrong

Portal item representing an ArcGIS vector tile service. The item's type must be AGSPortalItemTypeVectorTileService.

Note
The portal item can also contain custom style resources. See hasStyleResources.
This will be nil if the task was initialized with a URL.
Since
100.2

◆ requestConfiguration

- (AGSRequestConfiguration*) requestConfiguration
readwritenonatomicstronginherited

The AGSRequestConfiguration object which defines the behavior and policies to use when accessing the remote resource. The default will be nil. If it is nil the [AGSRequestConfiguration globalConfiguration] will be used.

Since
100

◆ URL

- (NSURL*) URL
readnonatomicstrong

The URL for exporting vector tiles.

This property can be the URL of:

  • A vector tile server that ends in "VectorTileServer" and is the rest end-point used to export vector tile packages. The vector tile service must be enabled for export or the task will fail to load.
  • A portal item for a vector tile service or a vector tiled layer with a custom style applied
  • A vector basemap layer created using an AGSBasemapStyle object

If the URL represents an AGSPortalItem object that can be used to download vector tiles or style resources, the AGSExportVectorTilesTask::portalItem property will be populated when the task is loaded.

Since
100.2

◆ vectorTileSourceInfo

- (AGSVectorTileSourceInfo*) vectorTileSourceInfo
readnonatomicstrong

Information about the source of vector tiles that this task will extract tiles from. The AGSVectorTileSourceInfo::exportTilesAllowed property should permit the tiles to be exported.

Since
100.2