OfflineMapTask Class

  • OfflineMapTask
  • class Esri::ArcGISRuntime::OfflineMapTask

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

    Header: #include <OfflineMapTask.h>
    Since: Esri::ArcGISRuntime 100.1
    Inherits: Esri::ArcGISRuntime::Object, Esri::ArcGISRuntime::Loadable, and Esri::ArcGISRuntime::RemoteResource

    This class was introduced in Esri::ArcGISRuntime 100.1.

    Public Functions

    OfflineMapTask(Esri::ArcGISRuntime::PortalItem *portalItem, QObject *parent = nullptr)
    OfflineMapTask(Esri::ArcGISRuntime::Map *onlineMap, QObject *parent = nullptr)
    virtual ~OfflineMapTask() override
    Esri::ArcGISRuntime::TaskWatcher createDefaultDownloadPreplannedOfflineMapParameters(Esri::ArcGISRuntime::PreplannedMapArea *area)
    Esri::ArcGISRuntime::TaskWatcher createDefaultGenerateOfflineMapParameters(const Esri::ArcGISRuntime::Geometry &areaOfInterest)
    Esri::ArcGISRuntime::TaskWatcher createDefaultGenerateOfflineMapParameters(const Esri::ArcGISRuntime::Geometry &areaOfInterest, double minScale, double maxScale)
    Esri::ArcGISRuntime::TaskWatcher createGenerateOfflineMapParameterOverrides(const Esri::ArcGISRuntime::GenerateOfflineMapParameters &parameters)
    Esri::ArcGISRuntime::DownloadPreplannedOfflineMapJob *downloadPreplannedOfflineMap(const Esri::ArcGISRuntime::DownloadPreplannedOfflineMapParameters &parameters, const QString &downloadDirectoryPath)
    Esri::ArcGISRuntime::GenerateOfflineMapJob *generateOfflineMap(const Esri::ArcGISRuntime::GenerateOfflineMapParameters &parameters, const QString &downloadDirectoryPath)
    Esri::ArcGISRuntime::GenerateOfflineMapJob *generateOfflineMap(const Esri::ArcGISRuntime::GenerateOfflineMapParameters &parameters, const QString &downloadDirectoryPath, Esri::ArcGISRuntime::GenerateOfflineMapParameterOverrides *parameterOverrides)
    Esri::ArcGISRuntime::TaskWatcher offlineMapCapabilities(const Esri::ArcGISRuntime::GenerateOfflineMapParameters &parameters)
    Esri::ArcGISRuntime::Map *onlineMap() const
    Esri::ArcGISRuntime::PortalItem *portalItem() const
    Esri::ArcGISRuntime::PreplannedMapAreaListModel *preplannedMapAreaList() const
    Esri::ArcGISRuntime::TaskWatcher preplannedMapAreas()

    Reimplemented Public Functions

    virtual void cancelLoad() override
    (obsolete) 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
    (obsolete) virtual Esri::ArcGISRuntime::RequestConfiguration requestConfiguration() const override
    virtual void retryLoad() override
    (obsolete) virtual void setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration) override

    Signals

    void createDefaultDownloadPreplannedOfflineMapParametersCompleted(QUuid taskId, const Esri::ArcGISRuntime::DownloadPreplannedOfflineMapParameters &parameters)
    void createDefaultGenerateOfflineMapParametersCompleted(QUuid taskId, const Esri::ArcGISRuntime::GenerateOfflineMapParameters &parameters)
    void createGenerateOfflineMapParameterOverridesCompleted(QUuid taskId, Esri::ArcGISRuntime::GenerateOfflineMapParameterOverrides *parameterOverrides)
    void doneLoading(Esri::ArcGISRuntime::Error loadError)
    void loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)
    void offlineMapCapabilitiesCompleted(QUuid taskId, const Esri::ArcGISRuntime::OfflineMapCapabilities &capabilities)
    void preplannedMapAreasCompleted(QUuid taskId)

    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 ahead-of-time workflow (also sometimes referred to as the preplanned workflow)
    • The on-demand workflow.

    Ahead-of-time workflow. In this workflow the author of a web map defines geographical areas (offline map areas) to take offline. ArcGIS Online, or ArcGIS Enterprise, uses these to prepare offline map content that is stored online. ArcGIS Runtime apps download the offline map content to a device using the ref@DownloadPreplannedOfflineMapJob. Note that ArcGIS Runtime APIs refer to an offline map area as a ref@PreplannedMapArea. For more information about authoring offline map areas, see Take web maps offline.

    On-demand workflow. Here the app passes a specific area of interest to a GenerateOfflineMapJob to generate and download the map content to the device. Using this workflow, you can choose to keep online only services (e.g., those that require a network connection) in your offline map. Be aware that an offline map that uses online only services will require a network connection and may require authentication.

    Member Function Documentation

    OfflineMapTask::OfflineMapTask(Esri::ArcGISRuntime::PortalItem *portalItem, QObject *parent = nullptr)

    Constructor that accepts a portal item and a parent object.

    • portalItem - The portal item that is a map to take offline.
    • parent - The parent object of this OfflineMapTask.

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

    OfflineMapTask::OfflineMapTask(Esri::ArcGISRuntime::Map *onlineMap, QObject *parent = nullptr)

    Constructor that accepts an online map and a parent object.

    • onlineMap - The online map to take offline.
    • parent - The parent object of this OfflineMapTask.

    [signal] void OfflineMapTask::createDefaultDownloadPreplannedOfflineMapParametersCompleted(QUuid taskId, const Esri::ArcGISRuntime::DownloadPreplannedOfflineMapParameters &parameters)

    Emitted when the createDefaultDownloadPreplannedOfflineMapParameters operation completes.

    • taskId - The task ID of the asynchronous operation.
    • parameters - The default parameters returned from the service.

    This function was introduced in Esri::ArcGISRuntime 100.5.

    [signal] void OfflineMapTask::createDefaultGenerateOfflineMapParametersCompleted(QUuid taskId, const Esri::ArcGISRuntime::GenerateOfflineMapParameters &parameters)

    Emitted when the createDefaultGenerateOfflineMapParameters operation completes.

    • taskId - The task ID of the asynchronous operation.
    • parameters - The default parameters returned from the service.

    [signal] void OfflineMapTask::createGenerateOfflineMapParameterOverridesCompleted(QUuid taskId, Esri::ArcGISRuntime::GenerateOfflineMapParameterOverrides *parameterOverrides)

    Emitted when the createGenerateOfflineMapParameterOverrides operation completes.

    • taskId - The task ID of the asynchronous operation.
    • parameterOverrides - A set of overrides to allow more fine-grained control of how individual services are taken offline.

    The returned GenerateOfflineMapParameterOverrides object has the OfflineMapTask as its parent.

    This function was introduced in Esri::ArcGISRuntime 100.4.

    See also Returned QObjects Parenting.

    [signal] void OfflineMapTask::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.

    See also Loadable and Object.

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

    Signal emitted when the load status changes for this object.

    See also Loadable.

    [signal] void OfflineMapTask::offlineMapCapabilitiesCompleted(QUuid taskId, const Esri::ArcGISRuntime::OfflineMapCapabilities &capabilities)

    Emitted when the offlineMapCapabilities operation completes.

    • taskId - The task ID of the asynchronous operation.
    • capabilities - The information about which layers and tables in the map can be taken offline.

    [signal] void OfflineMapTask::preplannedMapAreasCompleted(QUuid taskId)

    Emitted when the preplannedMapAreas operation completes.

    • taskId - The task ID of the asynchronous operation.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    [override virtual] OfflineMapTask::~OfflineMapTask()

    Destructor.

    [override virtual] void OfflineMapTask::cancelLoad()

    Reimplements: Loadable::cancelLoad().

    See Loadable.

    Esri::ArcGISRuntime::TaskWatcher OfflineMapTask::createDefaultDownloadPreplannedOfflineMapParameters(Esri::ArcGISRuntime::PreplannedMapArea *area)

    Asynchronously retrieves a DownloadPreplannedOfflineMapParameters with default values appropriate for taking the specified area offline.

    • area - The offline map area that is to be downloaded from the online map.

    Returns a TaskWatcher for this asynchronous operation.

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

    This function was introduced in Esri::ArcGISRuntime 100.5.

    Esri::ArcGISRuntime::TaskWatcher OfflineMapTask::createDefaultGenerateOfflineMapParameters(const Esri::ArcGISRuntime::Geometry &areaOfInterest)

    Asynchronously retrieves a GenerateOfflineMapParameters populated with default settings for a service.

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

    Returns a TaskWatcher for this asynchronous operation.

    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.

    Esri::ArcGISRuntime::TaskWatcher OfflineMapTask::createDefaultGenerateOfflineMapParameters(const Esri::ArcGISRuntime::Geometry &areaOfInterest, double minScale, double maxScale)

    Asynchronously retrieves a GenerateOfflineMapParameters populated with default settings for a service, created from the specified area of interest, min scale and max scale.

    Returns a TaskWatcher for this asynchronous operation.

    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 function was introduced in Esri::ArcGISRuntime 100.4.

    Esri::ArcGISRuntime::TaskWatcher OfflineMapTask::createGenerateOfflineMapParameterOverrides(const Esri::ArcGISRuntime::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 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::isContinueOnErrors.

    • 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.

    Returns a TaskWatcher for this asynchronous operation.

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

    The returned GenerateOfflineMapParameterOverrides object has the OfflineMapTask as its parent.

    This function was introduced in Esri::ArcGISRuntime 100.4.

    See also Returned QObjects Parenting.

    Esri::ArcGISRuntime::DownloadPreplannedOfflineMapJob *OfflineMapTask::downloadPreplannedOfflineMap(const Esri::ArcGISRuntime::DownloadPreplannedOfflineMapParameters &parameters, const QString &downloadDirectoryPath)

    Returns a job that is used to download the preplanned map area specified by the given parameters object.

    • parameters - Specifies parameters for the job including the preplanned map area to be downloaded.
    • downloadDirectoryPath - The path 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 function was introduced in Esri::ArcGISRuntime 100.4.

    Esri::ArcGISRuntime::GenerateOfflineMapJob *OfflineMapTask::generateOfflineMap(const Esri::ArcGISRuntime::GenerateOfflineMapParameters &parameters, const QString &downloadDirectoryPath)

    Returns a GenerateOfflineMapJob to run this OfflineMapTask.

    • parameters - The set of parameters to use to generate the offline content.
    • downloadDirectoryPath - The path 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".

    Esri::ArcGISRuntime::GenerateOfflineMapJob *OfflineMapTask::generateOfflineMap(const Esri::ArcGISRuntime::GenerateOfflineMapParameters &parameters, const QString &downloadDirectoryPath, Esri::ArcGISRuntime::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 parameterOverrides will be used instead.
    • downloadDirectoryPath - The path 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.

    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.

    To create an instance GenerateOfflineMapParameterOverrides use createGenerateOfflineMapParameterOverrides.

    Some properties on GenerateOfflineMapParameters will be ignored when using GenerateOfflineMapParameterOverrides and replaced with equivalent properties for each service. The overridden properties are:

    This function was introduced in Esri::ArcGISRuntime 100.4.

    [override virtual] void OfflineMapTask::load()

    Reimplements: Loadable::load().

    See Loadable.

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

    Reimplements: Loadable::loadError() const.

    See Loadable.

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

    Reimplements: Loadable::loadStatus() const.

    See Loadable.

    Esri::ArcGISRuntime::TaskWatcher OfflineMapTask::offlineMapCapabilities(const Esri::ArcGISRuntime::GenerateOfflineMapParameters &parameters)

    Asynchronously retrieves information on which layers will be included in an offline map.

    • parameters - The parameters to use to get the offline map capabilities.

    Returns a TaskWatcher for this asynchronous operation.

    Esri::ArcGISRuntime::Map *OfflineMapTask::onlineMap() const

    Returns the online map.

    Esri::ArcGISRuntime::PortalItem *OfflineMapTask::portalItem() const

    Returns the portal item.

    Esri::ArcGISRuntime::PreplannedMapAreaListModel *OfflineMapTask::preplannedMapAreaList() const

    Returns the list of preplanned map areas populated by preplannedMapAreas. Note that calling this method will load the OfflineMapTask if it is not already loaded.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    See also PreplannedMapArea.

    Esri::ArcGISRuntime::TaskWatcher OfflineMapTask::preplannedMapAreas()

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

    Returns a TaskWatcher for this asynchronous operation.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    [override virtual] void OfflineMapTask::retryLoad()

    Reimplements: Loadable::retryLoad().

    See Loadable.

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