Skip To Content ArcGIS for Developers Sign In Dashboard

MobileMapPackage Class


A mobile map package. More...

Header: #include <MobileMapPackage>
Since: Esri::ArcGISRuntime 100.0
Inherits: Object and Loadable

Public Functions

MobileMapPackage(const QString &path, QObject *parent = nullptr)
void close()
Expiration expiration() const
Item *item() const
LocatorTask *locatorTask() const
QList<Map *> maps() const
QString path() const
QString version() const

Reimplemented Public Functions

virtual void cancelLoad()
virtual void load()
virtual Error loadError() const
virtual LoadStatus loadStatus() const
virtual void retryLoad()


void doneLoading(Esri::ArcGISRuntime::Error loadError)
void loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)
void unpackCompleted(QUuid taskId, bool success)

Static Public Members

MobileMapPackage *instance()
TaskWatcher unpack(const QString &mobileMapPackageFilePath, const QString &outputDirectory)
  • 10 static public members inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

A mobile map package.

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, thumbnail, and so on), one or more mobile maps, layers, data, and optionally networks and locators.

A mobile map package can be created from ArcGIS Pro.


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

// instatiate a mobile map package
m_mobileMapPackage = new MobileMapPackage(path, this);

// wait for the mobile map package to load
connect(m_mobileMapPackage, &MobileMapPackage::doneLoading, this, [this](Error error)
  if (!error.isEmpty())
    qDebug() << QString("Package load error: %1 %2").arg(error.message(), error.additionalMessage());

  if (!m_mobileMapPackage || !m_mapView || m_mobileMapPackage->maps().isEmpty())

  // The package contains a list of maps that could be shown in the UI for selection.
  // For simplicity, obtain the first map in the list of maps.
  // set the map on the map view to display



Member Function Documentation

MobileMapPackage::MobileMapPackage(const QString &path, QObject *parent = nullptr)

Constructor that takes a file path and an optional parent.

The path can also be a path to the root folder that contains an exploded mobile map package.

Note: Constructing a MobileMapPackage from a path to a .mmpk file does not load the MobileMapPackage automatically. You must call load to load it explicitly.



[virtual] void MobileMapPackage::cancelLoad()

Reimplemented from Loadable::cancelLoad().

See Loadable.

void MobileMapPackage::close()

Closes a mobile map package.

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

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

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

Expiration MobileMapPackage::expiration() const

Gets expiration details for this mobile map package, if provided.

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

You should check Expiration::isEmpty to see whether the returned expiration object is valid.

If the package has expired and was authored as ExpirationType::preventExpiredAccess 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 function was introduced in Esri::ArcGISRuntime 100.5.

[static] MobileMapPackage *MobileMapPackage::instance()

Returns an instance of the MobileMapPackage singleton.

The instance is used to connect to the Object::errorOccurred, unpackCompleted signals. You do not need to obtain the instance to call the static methods on the MobileMapPackage.

This function was introduced in Esri::ArcGISRuntime 100.2.

Item *MobileMapPackage::item() const

Gets the item describing the contents of the mobile map package.

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

[virtual] void MobileMapPackage::load()

Reimplemented from Loadable::load().

See Loadable.

[virtual] Error MobileMapPackage::loadError() const

Reimplemented from Loadable::loadError().

See Loadable.

[virtual] LoadStatus MobileMapPackage::loadStatus() const

Reimplemented from Loadable::loadStatus().

See Loadable.

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

Signal emitted when the load status changes for this object.

  • loadStatus - The load status of this object.

See also Loadable.

LocatorTask *MobileMapPackage::locatorTask() const

Gets the locator contained in the mobile map package as a LocatorTask.

QList<Map *> MobileMapPackage::maps() const

Gets a list of the maps contained in the mobile map package.

QString MobileMapPackage::path() const

Gets the path of the mobile map package (.mmpk file).

[virtual] void MobileMapPackage::retryLoad()

Reimplemented from Loadable::retryLoad().

See Loadable.

[static] TaskWatcher MobileMapPackage::unpack(const QString &mobileMapPackageFilePath, const QString &outputDirectory)

Unpacks the mobile map package at mobileMapPackageFilePath to the outputDirectory

This method returns a TaskWatcher for the asynchronous operation. Connect to the MobileMapPackage singleton provided by the instance() method to determine when the operation is completed.

The unpack task writes the full content of the mobile map package to the output directory. Care should be taken on devices with limited storage space, especially if the original package is very large. After unpacking, you can remove the original .mmpk file from the device.

This function was introduced in Esri::ArcGISRuntime 100.2.

[signal] void MobileMapPackage::unpackCompleted(QUuid taskId, bool success)

Signal emitted when unpack completes.

  • taskId - The task ID that this signal corresponds to.
  • success - Whether the task was successful.

QString MobileMapPackage::version() const

Returns the version of the mobile map package.

Feedback on this topic?