Skip To Content ArcGIS for Developers Sign In Dashboard

OfflineMapTask QML Type

A task with methods related to taking a map offline and synchronizing online and offline maps. More...

Import Statement: import Esri.ArcGISRuntime 100.6
Since: Esri.ArcGISRuntime 100.1
Inherits:

Object

Properties

Signals

Methods

Detailed Description

Taking a map offline involves downloading an online map and its data, including all the supported layers, tables, renderers, web map configuration and so on, so that the map may be used offline without a network connection.

There are two workflows available for taking maps offline:

  • the preplanned offline workflow.
  • the on-demand offline workflow.

In the Preplanned offline workflow, the author of an online map can define individual geographical areas called map areas. These map areas prepare map content that is stored online. An app can download that map content to a device using a DownloadPreplannedOfflineMapJob.

In the On-demand offline workflow, the app passes a specific area of interest to a GenerateOfflineMapJob to generate and download the map content to the device.

This object may be instantiated with an onlineMap or a portalItem, but not with both.

This QML type supports the following default properties. A default property may be declared inside another declared object without being assigned explicitly to a property.

See also Loadable, Cancelable, and RemoteResource.

Property Documentation

createDefaultDownloadPreplannedOfflineMapParametersResult : DownloadPreplannedOfflineMapParameters

Returns the results of getting the parameters for downloading a preplanned offline map (read-only).

The results are from a task used to generate DownloadPreplannedOfflineMapParameters for a preplanned area.

This QML property was introduced in Esri::ArcGISRuntime 100.5.


createDefaultDownloadPreplannedOfflineMapParametersStatus : Enums.TaskStatus

Returns a Enums.TaskStatus of the DownloadPreplannedOfflineMapParameters task (read-only).

This QML property was introduced in Esri.ArcGISRuntime 100.5.


createDefaultGenerateOfflineMapParametersResult : GenerateOfflineMapParameters

Returns the results from getting the default parameters for taking a map offline (read-only).

The results are from a task used to generate GenerateOfflineMapParameters for an area of interest.


createDefaultGenerateOfflineMapParametersStatus : Enums.TaskStatus

Returns a Enums.TaskStatus of the GenerateOfflineMapParameters task (read-only).


createGenerateOfflineMapParameterOverridesResult : GenerateOfflineMapParameterOverrides

Returns the results from getting the parameter overrides for taking a map offline (read-only).

The results are from a task used to generate GenerateOfflineMapParameterOverrides from a set of GenerateOfflineMapParameters.

This QML property was introduced in Esri::ArcGISRuntime 100.4.


createGenerateOfflineMapParameterOverridesStatus : Enums.TaskStatus

Returns a Enums.TaskStatus of the GenerateOfflineMapParameterOverrides task (read-only).

This QML property was introduced in Esri.ArcGISRuntime 100.4.


[default] credential : Credential

The credential for authenticating against a secured service.

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


loadError : Error

Returns the load error (read-only).

Note: load errors are also reported on the error property and emit the errorChanged signal.

See also Loadable and Object.


loadStatus : Enums.LoadStatus

Returns the load status (read-only).

See also Loadable and Enums.LoadStatus.


offlineMapCapabilitiesResult : OfflineMapCapabilities

Returns the results from getting the capabilities of an offline map (read-only).

The results are from a task created with offlineMapCapabilities, used to generate capabilities of an offline map.


offlineMapCapabilitiesStatus : Enums.TaskStatus

Returns a Enums.TaskStatus of offlineMapCapabilities (read-only).


[default] onlineMap : Map

The online map within this task.

An OfflineMapTask object may be instantiated with an onlineMap or a portalItem, but not with both.


[default] portalItem : PortalItem

The portal item specifying the map to be taken offline.

An OfflineMapTask object may be instantiated with an onlineMap or a portalItem, but not with both.

The PortalItem must be of type PortalItemType::WebMap - either on ArcGIS Online or an on-premise ArcGIS Enterprise Portal.


preplannedMapAreaList : PreplannedMapAreaListModel

Returns the list of preplanned map areas populated by preplannedMapAreas.

This QML property was introduced in Esri.ArcGISRuntime 100.2.

See also PreplannedMapArea.


preplannedMapAreasStatus : Enums.TaskStatus

Returns a Enums.TaskStatus of the preplannedMapAreas task (read-only).

This QML property was introduced in Esri.ArcGISRuntime 100.2.


[default] requestConfiguration : RequestConfiguration

The configuration parameters used for network requests sent by this task.


url : url

This inherited property is unused with OfflineMapTask.


Signal Documentation

createDefaultDownloadPreplannedOfflineMapParametersStatusChanged()

Emitted when the createDefaultDownloadPreplannedOfflineMapParametersStatus property or the createDefaultGenerateOfflineMapParametersResult property changes.

This QML signal was introduced in Esri.ArcGISRuntime 100.5.


createDefaultGenerateOfflineMapParametersStatusChanged()


createGenerateOfflineMapParameterOverridesStatusChanged()

Emitted when the createGenerateOfflineMapParameterOverridesStatus property or the createGenerateOfflineMapParameterOverridesResult property changes.

This QML signal was introduced in Esri.ArcGISRuntime 100.4.


credentialChanged()

Emitted when the credential property changes.


loadErrorChanged()

Emitted when the loadError property changes.

See also Loadable and Object.


loadStatusChanged()

Emitted when the loadStatus property changes.

See also Loadable.


offlineMapCapabilitiesStatusChanged()

Emitted when the offlineMapCapabilitiesStatus property or the offlineMapCapabilitiesResult property changes.


onlineMapChanged()

Emitted when the onlineMap property changes.


portalItemChanged()

Emitted when the portalItem property changes.


preplannedMapAreasStatusChanged()

Emitted when the preplannedMapAreasStatus property changes.

This QML signal was introduced in Esri.ArcGISRuntime 100.2.


requestConfigurationChanged()

Emitted when the requestConfiguration property changes.


urlChanged()

Emitted when the url property changes.


Method Documentation

void cancelLoad()

See also Loadable.


bool cancelTask(string taskId)

Cancels an OfflineMapTask.

  • taskId - The ID of the task to cancel.

See also Cancelable.


string createDefaultDownloadPreplannedOfflineMapParameters(PreplannedMapArea area)

Gets DownloadPreplannedOfflineMapParameters with default values appropriate for taking the specified area offline.

  • area - The preplanned region of the online map that is to be taken offline.

This method returns a string representing the task ID of the task.

Uses an asynchronous task to get the default parameters, which are returned in the createDefaultDownloadPreplannedOfflineMapParametersResult property when the task completes. Wait for the createDefaultDownloadPreplannedOfflineMapParametersStatusChanged signal to emit and the createDefaultGenerateOfflineMapParametersStatus to be Enums.TaskStatusCompleted before retrieving the result.

If the web map author has set a reference basemap filename, this will be set into the DownloadPreplannedOfflineMapParameters::referenceBasemapFilename property.

This QML method was introduced in Esri::ArcGISRuntime 100.5.


string createDefaultGenerateOfflineMapParameters(Geometry areaOfInterest, double minScale, double maxScale)

Gets the default parameters for taking a map offline.

  • areaOfInterest - The geographic area of interest for the offline map. The area of interest must have a spatial reference.
  • minScale - The minimum scale for the offline map and offline tile caches. Use 0 for all far out levels. Sets the property GenerateOfflineMapParameters::minScale.
  • maxScale - The maximum scale for the offline map and offline tile caches. Use 0 for all closer in detailed levels. Sets the property GenerateOfflineMapParameters::maxScale.

This method returns a string representing the task ID of the task.

Uses an asynchronous task to get the default parameters, which are returned in the createDefaultGenerateOfflineMapParametersResult property when the task completes. Wait for the createDefaultGenerateOfflineMapParametersStatusChanged signal to emit and the createDefaultGenerateOfflineMapParametersStatus to be Enums.TaskStatusCompleted before retrieving the result.

This will populate the parameters with default values for all the input parameters defined by the service. If the service defines a default value for a parameter, this will be used. If no default value is defined for a parameter, it will be given an appropriate default for its type: Boolean parameters false, string parameters an empty string, and numerical parameters zero.

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, features and tiles will be filtered according to the polygon geometry, which can help reduce the size of the resulting offline map. Note that the filtered set of tiles may vary, depending on the underlying service.

The returned GenerateOfflineMapParameters has its itemInfo property initialized from the offline map task's portal item, if that is set. The item info's thumbnail will be copied from the portal item's thumbnail.

This QML method was introduced in Esri::ArcGISRuntime 100.4.


string createDefaultGenerateOfflineMapParameters(Geometry areaOfInterest)

Gets the default parameters for taking a map offline.

  • areaOfInterest - The geographic area of interest for the offline map.

This method returns a string representing the task ID of the task.

Uses an asynchronous task to get the default parameters, which are returned in the createDefaultGenerateOfflineMapParametersResult property when the task completes. Wait for the createDefaultGenerateOfflineMapParametersStatusChanged signal to emit and the createDefaultGenerateOfflineMapParametersStatus to be Enums.TaskStatusCompleted before retrieving the result.

This will populate the parameters with default values for all the input parameters defined by the service. If the service defines a default value for a parameter, this will be used. If no default value is defined for a parameter, it will be given an appropriate default for its type: Boolean parameters false, string parameters an empty string, and numerical parameters zero.

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, features and tiles will be filtered according to the polygon geometry, which can help reduce the size of the resulting offline map. Note that the filtered set of tiles may vary, depending on the underlying service.

The returned parameters min scale and max scale are 0, so data will be taken at the full range of scales the services support.


string createGenerateOfflineMapParameterOverrides(GenerateOfflineMapParameters parameters)

Asynchronously retrieves a GenerateOfflineMapParameterOverrides created from the specified parameters.

  • parameters - The generate offline map parameters from which the overrides will be populated.

When the task completes the GenerateOfflineMapParameterOverrides will be populated reflecting the values in the GenerateOfflineMapParameters parameters. The overrides may be inspected and modified to change the offline data before passing onto creating a job with OfflineMapTask::generateOfflineMap.

If there are errors with loading individual layers or tables, or they cannot be taken offline due to service settings, the outcome depends on the value of GenerateOfflineMapParameters::continueOnErrors.

  • If this property is true, the overrides correspond to the remaining layers and tables that can go offline. The resulting offline map will not contain the layers or tables which had errors.
  • If this property is false, the task will fail with an Error from the failed layer or table.

To check upfront which layers or tables are valid for taking offline, see offlineMapCapabilities.

If GenerateOfflineMapParameters::referenceBasemapDirectory is set, the overrides corresponding to online basemap layers will be omitted, since no basemap layers will be downloaded.

Uses an asynchronous task to get the parameter overrides, which are returned in the createGenerateOfflineMapParameterOverridesResult property when the task completes. Wait for the createGenerateOfflineMapParameterOverridesStatusChanged signal to emit and the createGenerateOfflineMapParameterOverridesStatus to be Enums.TaskStatusCompleted before retrieving the result.

This QML method was introduced in Esri::ArcGISRuntime 100.4.


DownloadPreplannedOfflineMapJob downloadPreplannedOfflineMap(PreplannedMapArea area, url downloadDirectoryPath, bool excludeBasemap = false)

Returns a job that is used to download the specified preplanned map area of an online map.

  • area - Specifies the preplanned map area to be downloaded.
  • downloadDirectoryPath - The url to a folder where the map content is stored on the device. For example, to create a new mobile map package "my_mobile_map_package" in a parent directory "[my root path]/my_mobile_maps", this property would be "[my root path]/my_mobile_maps/my_mobile_map_package".
  • excludeBasemap - Specifies whether to exclude the basemap from the offline map. By default, this is set to false.

If you exclude the map's basemap from the download the offline map's size will be smaller and consequently the download process will be faster. If you already have a basemap stored locally on your device you can add that to the offline map.

Note: The job that is returned is not started and needs to be explicitly started. The job will fail if the last directory in the download directory path cannot be created or is not empty.

This QML method was introduced in Esri.ArcGISRuntime 100.2.


DownloadPreplannedOfflineMapJob downloadPreplannedOfflineMapWithParameters(DownloadPreplannedOfflineMapParameters parameters, url downloadDirectoryPath)

Returns a job that is used to download the specified preplanned map area of an online map.

  • parameters - Specifies the preplanned map area to be downloaded.
  • downloadDirectoryPath - The url to a folder where the map content is stored on the device. For example, to create a new mobile map package "my_mobile_map_package" in a parent directory "[my root path]/my_mobile_maps", this property would be "[my root path]/my_mobile_maps/my_mobile_map_package".

Note: The job that is returned is not started and needs to be explicitly started. The job will fail if the last directory in the download directory path cannot be created or is not empty.

This QML method was introduced in Esri.ArcGISRuntime 100.4.


GenerateOfflineMapJob generateOfflineMap(GenerateOfflineMapParameters parameters, url downloadDirectoryPath)

Create a Job to run this OfflineMapTask.

  • parameters - The set of parameters to use to generate the offline content.
  • downloadDirectoryPath - The url to a folder where the map content is stored on the device. For example, to create a new mobile map package "my_mobile_map_package" in a parent directory "[my root path]/my_mobile_maps", this property would be "[my root path]/my_mobile_maps/my_mobile_map_package".

Returns a GenerateOfflineMapJob. Start this job to begin generating the offline map.


GenerateOfflineMapJob generateOfflineMapWithOverrides(GenerateOfflineMapParameters parameters, url downloadDirectoryPath, GenerateOfflineMapParameterOverrides parameterOverrides)

Returns a job that is used to generate an offline map using the specified parameters and overrides.

  • parameters - Parameters to specify how to take a map offline. For example, specify the area of interest, min and max scale, layer attachment options. Note that any properties relating to layers should be taken offline will be ignored and the values in the overrides will be used instead.
  • downloadDirectoryPath - The url to a folder where the map content is stored on the device. For example, to create a new mobile map package "my_mobile_map_package" in a parent directory "[my root path]/my_mobile_maps", this property would be "[my root path]/my_mobile_maps/my_mobile_map_package".
  • parameterOverrides. The overrides to the parameters which control how individual services are taken offline. These take precedence over settings in the parameters.

This QML method was introduced in Esri::ArcGISRuntime 100.4.


void load()

See also Loadable.


string offlineMapCapabilities(GenerateOfflineMapParameters parameters)

Asynchronously retrieves information about which layers and tables in the map can be taken offline.

Returns a string representing the task ID of the asynchronous task.


string preplannedMapAreas()

Asynchronously retrieves a list of preplanned map areas, if there are any.

Returns a string representing the task ID of the asynchronous task.

This QML method was introduced in Esri.ArcGISRuntime 100.2.


void retryLoad()

See also Loadable.



Feedback on this topic?