ArcGIS Runtime SDK for iOS
100.15
|
A mobile map package.
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:
You can create a mobile map package using either:
AGSMobileMapPackage
up to major version 5
. Mobile map packages created with ArcGIS Pro are stored in a file with an .mmpk extension. generateOfflineMapJobWithParameters:downloadDirectory: (AGSOfflineMapTask)
method to generate and download a mobile map package on-demand, or use the downloadPreplannedOfflineMapJobWithParameters:downloadDirectory: (AGSOfflineMapTask)
to download a mobile map package already prepared by the map author. Mobile map packages created with the AGSOfflineMapTask
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 AGSItem
object 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:
AGSMap::basemap
property. AGSGeoModel::operationalLayers
property. 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 AGSLoadable
interface; you need to load the AGSMobileMapPackage
object before you can access its content.
Once loaded you can:
AGSMobileMapPackage::version
property. ArcGIS Runtime currently supports mobile map packages up to and including major version 5
. If the package is from an unsupported version, it will fail to load. AGSMobileMapPackage::expiration
property AGSMapView
object Instance Methods | |
(void) | - cancelLoad |
(void) | - close |
(void) | - doCancelLoading |
(void) | - doStartLoading: |
(instancetype) | - initWithFileURL: |
(instancetype) | - initWithName: |
(void) | - loadDidFinishWithError: |
(void) | - loadWithCompletion: |
(void) | - onLoadStatusChanged |
(void) | - retryLoadWithCompletion: |
Class Methods | |
(id< AGSCancelable >) | + checkDirectReadSupportForMobileMapPackageAtFileURL:completion: |
(instancetype) | + mobileMapPackageWithFileURL: |
(instancetype) | + mobileMapPackageWithName: |
(id< AGSCancelable >) | + unpackMobileMapPackageAtFileURL:outputDirectory:completion: |
Properties | |
AGSExpiration * | expiration |
NSURL * | fileURL |
AGSItem * | item |
NSError * | loadError |
AGSLoadStatus | loadStatus |
AGSLocatorTask * | locatorTask |
NSArray< AGSMap * > * | maps |
NSString * | version |
|
requiredinherited |
Cancels loading if it is in progress, otherwise it does nothing. This should be called carefully because other objects could be waiting for loadWithCompletion:
or retryLoadWithCompletion:
to complete and this will call them all back with the error of NSUserCancelledError
+ (id<AGSCancelable>) checkDirectReadSupportForMobileMapPackageAtFileURL: | (NSURL *) | fileURL | |
completion: | (void(^)(BOOL isDirectReadSupported, NSError *__nullable error)) | completion | |
Checks if the package can be read directly without requiring to be unpacked. isDirectReadSupported
will always be YES
after deprecation in version 100.7.
Prior to ArcGIS Runtime version 100.7, some data formats (such as AGSRasterLayer
) could only be accessed if they were unpacked from the mobile map package file (.mmpk). In these situations, isDirectReadSupported
would be NO
and you would need to call the AGSMobileMapPackage::unpackWithMobileMapPackageFileURL:outputDirectory:completion:
to unpack the mmpk.
From version 100.7 and onwards this limitation has been removed allowing the data to be read directly from the mobile map package file. isDirectReadSupported
is always YES
.
Since this method is no longer required it can be removed from calling code including any subsequent use of AGSMobileMapPackage::unpackWithMobileMapPackageFileURL:outputDirectory:completion:
.
fileURL | A file URL to the mmpk file. |
completion | A block that is invoked with information about whether direct read is supported if the operation succeeds, or an error if it fails. |
AGSMobileMapPackage::unpackWithMobileMapPackageFileURL:outputDirectory:completion:
AGSMobileMapPackage::unpackWithMobileMapPackageFileURL:outputDirectory:completion:
. Provided by category AGSMobileMapPackage(AGSDeprecated).
- (void) 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 closing it 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.
- close (AGSGeodatabase)
- (void) doCancelLoading |
Never call this method directly. The framework calls this method on a background thread when cancelLoad (AGSLoadable-p)
is called. It is meant to be overriden by subclasses. Subclasses should override this method to cancel loading their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly))
at the end passing in an error representing NSUserCancelledError
.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
- (void) doStartLoading: | (BOOL) | retrying |
Never call this method directly. The framework calls this method on a background thread when loadWithCompletion: (AGSLoadable-p)
or retryLoadWithCompletion: (AGSLoadable-p)
is called. It is meant to be overriden by subclasses. Subclasses should override this method to load their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly))
upon completion, passing in the error if any.
retrying | flag that is true if this method was called from retryLoadWithCompletion: (AGSLoadable-p) . |
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
- (void) loadDidFinishWithError: | (nullable NSError *) | error |
Only subclasses should call this method in doStartLoading: (AGSLoadableBase(ForSubclassEyesOnly))
and doCancelLoading (AGSLoadableBase(ForSubclassEyesOnly))
when done loading or failed to load.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
|
requiredinherited |
Loads data for the object asynchronously. The completion block is invoked upon completion.
You can call this method any number of times, however only one attempt is made to load the data. If it is already loading, it will just continue to load (i.e. not force a reload). If it has already loaded successfully, the completion block will be invoked right away. If it has already failed to load, the completion block will be invoked right away with error previously encountered. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.
completion | block that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load. |
- cancelLoad
to cancel loading - retryLoadWithCompletion:
to force reload - (void) onLoadStatusChanged |
Never call this method directly. The framework calls this method on a background thread when AGSLoadable::loadStatus
changes is called. Subclasses can optionally implement this to know when their loading status has changed.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
|
requiredinherited |
Tries to reload when an object has failed to load. This method should be called judiciously. It should be called when:
cancelLoad
and then this methodIf the data hasn't started loading, it will start loading. If it is already loading, it will just continue to load. If it has already loaded successfully, calls back right away. If it has already failed to load, tries again. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.
completion | block that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load. |
+ (id<AGSCancelable>) unpackMobileMapPackageAtFileURL: | (NSURL *) | fileURL | |
outputDirectory: | (NSURL *) | outputDirectory | |
completion: | (void(^)(NSError *__nullable error)) | completion | |
Unpacks a mobile map package file (.mmpk) to the specified directory. Note that unpacking will fail if the package is expired and was authored as AGSExpirationTypePreventExpiredAccess
.
fileURL | A file URL to the mmpk file. |
outputDirectory | An output directory specifying where to unpack the package. If the last component of the directory location does not exist, it will be created during unpacking. |
completion | A block that is invoked when the operation completes. |
|
readnonatomicstrong |
Expiration details for this mobile map package, if provided.
Expiration details provide:
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 AGSOfflineMapTask
object 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 AGSExpirationTypePreventExpiredAccess
, 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.
|
readnonatomicstrong |
The URL of the mobile map package (.mmpk file) on disk or a directory containing an unpacked mobile map package.
|
readnonatomicstrong |
The mobile map package's AGSItem
object describing metadata about the package.
The item includes the metadata about the mobile map package, such as:
AGSOfflineMapTask
, the metadata was provided by the originating web map.A package's item will be an instance of an AGSLocalItem
.
Returns nil
if the package is not loaded.
AGSItem
|
readnonatomicstronginherited |
The error that was encountered during the most recent load operation. Will be nil if the operation succeeded.
|
readrequirednonatomicassigninherited |
Status of the load operation.
|
readnonatomicstrong |
An AGSLocatorTask
object from the mobile map package.
Use this task to geocode and reverse-geocode addresses and places. There is only one AGSLocatorTask
object in each mobile map package but it can be used by all maps.
Returns nil
if there is no AGSLocatorTask
in the package or the package is not loaded.
AGSLocatorTask
|
readnonatomiccopy |
An array of AGSMap
objects from the AGSMobileMapPackage
object.
To use the maps in an AGSMobileMapPackage
object, 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 AGSOfflineMapTask
object will only contain one map.
If you display the map by setting the map to an AGSMapView
object, 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 AGSMap::load
. If the package is not loaded, an empty NSArray
is returned.
|
readnonatomiccopy |
The mobile map package's version.
The mobile map package version is set when the package is authored in ArcGIS Pro or when it is generated by the AGSOfflineMapTask
object.
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 5
.
You may wish to check the version property before trying to access specific functionality.
For example:
If the package fails to load, check that the version number has not exceeded the supported major version.