Skip To Content ArcGIS for Developers Sign In Dashboard

MobileMapPackage QML Type

A mobile map package. More...

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

Object

Properties

Signals

Methods

Detailed Description

A mobile map package (a .mmpk file) is a transport mechanism for mobile maps, their layers, and the layer's data. It contains metadata about the package (description, etc.), one or more mobile maps, layers, data, and optionally networks and locators.

A mobile map package can be created from ArcGIS Pro.

Example:

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

readonly property url dataPath: System.userHomePath + "/ArcGIS/Runtime/Data/mmpk/"
readonly property url unpackPath: System.temporaryFolder.url + "/MmpkQml_%1.mmpk".arg(new Date().getTime().toString())

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

Component.onCompleted: {
    // check if direct read is supported before proceeding
    MobileMapPackageUtility.isDirectReadSupported(mmpk.path);
}

// 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));
    }
}

// Connect to the various signals on MobileMapPackageUtility
// to determine if direct read is supported or if an unpack
// is needed.
Connections {
    target: MobileMapPackageUtility

    onIsDirectReadSupportedStatusChanged: {
        if (MobileMapPackageUtility.isDirectReadSupportedStatus !== Enums.TaskStatusCompleted) {
            return;
        }

        // if direct read is supported, load the MobileMapPackage
        if (MobileMapPackageUtility.isDirectReadSupportedResult) {
            mmpk.load();
        } else {
            // direct read is not supported, and the data must be unpacked
            MobileMapPackageUtility.unpack(mmpk.path, unpackPath)
        }
    }

    onUnpackStatusChanged: {
        if (MobileMapPackageUtility.unpackStatus !== Enums.TaskStatusCompleted)
            return;

        // set the new path to the unpacked mobile map package
        mmpk.path = unpackPath;

        // load the mobile map package
        mmpk.load();
    }
}

See also Loadable.

Property Documentation

expiration : Expiration

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

If the mobile map package was authored with expiration, this property will be populated when the package is loaded or fails to load.

If the package has expired and was authored as Enums.ExpirationTypePreventExpiredAccess then loading will fail and the package can no longer be used.

This property will still be populated even in the event of a load failure.

This QML property was introduced in Esri.ArcGISRuntime 100.5.


item : ArcGISItem

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

This property can be retrieved after the MobileMapPackage is loaded.

The mobile map package will contain information about itself. The information is equivalent to the JSON description of an item plus a few additional properties.


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

This property can be retrieved after the MobileMapPackage is loaded.


maps : list<Map>

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

This property can be retrieved after the MobileMapPackage is loaded.


path : url

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

This property cannot be set after the MobileMapPackage is loaded.


version : string

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


Signal Documentation

expirationChanged()

Emitted when the expiration property changes.

This QML signal was introduced in Esri.ArcGISRuntime 100.5.


itemChanged()

Emitted when the item property changes.


loadErrorChanged()

Emitted when the loadError property changes.

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

See also Loadable and Object.


loadStatusChanged()

Emitted when the loadStatus property changes.

See also Loadable.


locatorTaskChanged()

Emitted when the locatorTask property changes.


mapsChanged()

Emitted when the maps property changes.


pathChanged()

Emitted when the path property changes.


versionChanged()

Emitted when the version property changes.


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 QML 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?