Skip To Content ArcGIS for Developers Sign In Dashboard

MobileMapPackage QML Type

A mobile map package. More...

Import Statement: import Esri.ArcGISRuntime 100.9
Since: Esri.ArcGISRuntime 100.0
Inherits:

Object

Properties

Signals

Methods

Detailed Description

Mobile map packages allow you to work with maps on a mobile device. A mobile map package contains all of the files necessary to work with your maps and is stored on a device as either:

  • A single archive file with an .mmpk extension.
  • A directory containing an unpacked mobile map package.

You can create a mobile map package using either:

  • ArcGIS Pro (from version 1.3). This version of the ArcGIS Runtime SDK supports any MobileMapPackage up to major version 4. Mobile map packages created with ArcGIS Pro are stored in a file with an .mmpk extension.
  • ArcGIS Runtime. Use the OfflineMapTask::generateOfflineMap method to generate and download a mobile map package on-demand, or use the OfflineMapTask::downloadPreplannedOfflineMap to download a mobile map package already prepared by the map author. Mobile map packages created with the OfflineMapTask are stored in a directory containing an unpacked mobile map package.

A mobile map package can encapsulate one or more maps along with their layers and data. Each package contains an ArcGISItem with metadata about the package (description, thumbnail, etc.).

Mobile map packages created with ArcGIS Pro can also include transportation networks, locators, and links to online services. You can choose whether to use:

  • A tile package (such as .tpkx or .vptk) or an online basemap as the Map::basemap.
  • A mobile geodatabase (.geodatabase) or an online feature service as one of the Map::operationalLayers.

Online services (such as traffic or weather) can provide excellent contextual information for your users. If the mobile map package is going to be used in areas of poor connectivity, however, you must ensure that data critical to your workflow is stored locally on the device.

Mobile map packages implement the Loadable interface; you need to load the MobileMapPackage before you can access its content. Once loaded you can:

  • Determine the version of this package using the MobileMapPackage::version property. ArcGIS Runtime currently supports mobile map packages up to and including major version 4. If the package is from an unsupported version, it will fail to load.
  • Discover whether the mobile map package has expired using the MobileMapPackage::expiration property.
  • Access the individual maps and display them in a MapView.
  • Programmatically add, modify, and remove layers in the map. Mobile map packages, however, are read-only and these changes to maps or layers are not persisted.

Example:

Obtain a Map from a MobileMapPackage and display it in a MapView

readonly property url dataPath: System.userHomePath + "/ArcGIS/Runtime/Data/mmpk/"

// Create MapView
MapView {
    id: mapView
    anchors.fill: parent
}

Component.onCompleted: {
    mmpk.load();
}

// Create a Mobile Map Package and set the path
MobileMapPackage {
    id: mmpk
    path: dataPath + "Yellowstone.mmpk"

    // wait for the mobile map package to load
    onLoadStatusChanged: {
        // only proceed once the map package is loaded
        if (loadStatus !== Enums.LoadStatusLoaded) {
            return;
        }

        if (mmpk.maps.length < 1) {
            return;
        }

        // set the map view's map to the first map in the mobile map package
        mapView.map = mmpk.maps[0];
    }

    onErrorChanged: {
        console.log("Mobile Map Package Error: %1 %2".arg(error.message).arg(error.additionalMessage));
    }
}

See also Loadable.

Property Documentation

expiration : Expiration

Expiration details for this mobile map package, if provided. (read-only).

Expiration details provide:

  • The package’s expiration date and time.
  • Whether the maps can be accessed after expiration.
  • Any messages relevant for the user.

These expiration details can be specified when the author creates a mobile map package using ArcGIS Pro (from version 2.4). This requires the ArcGIS Pro Publisher Extension. Mobile map packages created with the OfflineMapTask do not support expiration.

By publishing a package with expiration details, the author can control the experience an end-user has when they try to access information that is no longer valid. For example, for time limited data (such as major sporting events), the author can ensure that the data cannot be accessed after the expiry date.

During package loading, the ArcGIS Runtime will determine whether the mobile map package was authored with expiration. If so, then this property will be populated.

If the package has expired and was authored as (Enums.ExpirationTypePreventExpiredAccess), loading will fail and you will not be able to access the maps. The expiration details will be accessible for you to examine and/or communicate to the user.

If the expiration property is null the Expiration object is not valid.

This property was introduced in Esri.ArcGISRuntime 100.5.


item : ArcGISItem

Returns an ArcGISItem object describing the contents of the mobile map package (read-only).

The item includes the metadata about the mobile map package, such as:

  • Title
  • Snippet (summary)
  • Description
  • Tags
  • Thumbnail

If the package was created with ArcGIS Pro, the metadata was provided by the package author. If the package was created using the OfflineMapTask, the metadata was provided by the originating web map.

A package's item will be an instance of a LocalItem.

Returns null if the package is not loaded.


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.


loadStatus : Enums.LoadStatus

Returns the load status (read-only).

See also Loadable and Enums.LoadStatus.


locatorTask : LocatorTask

Returns the locator contained in the mobile map package as a LocatorTask (read-only).

Use this task to geocode and reverse-geocode addresses and places. There is only one LocatorTask in each mobile map package but it can be used by all maps.

Returns null if there is no LocatorTask in the package or the package is not loaded.

See also LocatorTask.


maps : list<Map>

Returns a list of the maps contained in the mobile map package (read-only).

To use the maps in a MobileMapPackage, you first need to load the package. If the mobile map package was created with ArcGIS Pro, the maps are presented in the same order in which they were packaged. Mobile map packages created with the OfflineMapTask will only contain one map.

If you display the map by setting the map to a MapView, the map will automatically load. If you only need to access the map's content or metadata, you will need to load it by calling Map::load. If the package is not loaded, an empty collection is returned.


path : url

The path to the mobile map package (.mmpk file) or the root folder in case of an exploded mmpk.

The path can refer to a file with an .mmpk extension or a directory containing an unpacked mobile map package.

This property cannot be set after the MobileMapPackage is loaded.


version : string

Returns the version of this mobile map package (read-only).

The mobile map package version is set when the package is authored in ArcGIS Pro or when it is generated by the OfflineMapTask.

This property will be populated when you attempt to load the package. The version property will always be populated for you to examine, even if the package is an unsupported version.

ArcGIS Runtime SDKs currently support mobile map packages up to and including major version 4.

You may wish to check the version property before trying to access specific functionality. For example:

  • Expiration details are only available from mobile map package version 3.1 onwards.
  • Links to online services are only available from mobile map package version 4.0 onwards.

If the package fails to load, check that the version number has not exceeded the supported major version.


Signal Documentation

expirationChanged()

Emitted when the expiration property changes.

Note: The corresponding handler is onExpirationChanged.

This signal was introduced in Esri.ArcGISRuntime 100.5.


itemChanged()

Emitted when the item property changes.

Note: The corresponding handler is onItemChanged.


loadErrorChanged()

Emitted when the loadError property changes.

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

Note: The corresponding handler is onLoadErrorChanged.

See also Loadable and Object.


loadStatusChanged()

Emitted when the loadStatus property changes.

Note: The corresponding handler is onLoadStatusChanged.

See also Loadable.


locatorTaskChanged()

Emitted when the locatorTask property changes.

Note: The corresponding handler is onLocatorTaskChanged.


mapsChanged()

Emitted when the maps property changes.

Note: The corresponding handler is onMapsChanged.


pathChanged()

Emitted when the path property changes.

Note: The corresponding handler is onPathChanged.


versionChanged()

Emitted when the version property changes.

Note: The corresponding handler is onVersionChanged.


Method Documentation

void cancelLoad()

See also Loadable.


void close()

Closes a mobile map package and frees file locks on the underlying .mmpk file or directory.

All references to mobile map package data (maps, layers, tables, networks, locators, etc.) should be released before closing the package. If active references to mobile map package data exist, this method will still close the package, but subsequent rendering and data access methods will fail. Results of accessing mobile map package data after close are undefined.

After closing a mobile map package, the underlying .mmpk file or directory can be moved or deleted.

Closing a mobile map package is not necessary if the package has not been loaded.

This method was introduced in Esri.ArcGISRuntime 100.6.

See also MobileScenePackage::close and Geodatabase::close.


void load()

See also Loadable.


void retryLoad()

See also Loadable.



Feedback on this topic?