What are the limitations for utilizing MMPK's? Specifically, here are several questions I have:
- Q1: How many MMPK's can you reference in a document?
- Q2: Can you legally point to a specific layer in an MMPK and add it to a map?
- Q3: Is it legal to have a MMPK with no basemap?
- Q4: If you have no basemap, then how to you set the default color of a map created by the mmpk?
Regarding Q1 & Q2, If I have two MMPK's, and I'd like layer "A" off of a.mmpk and layer "B" off of b.mmpk, is this possible?
If I add the layers via the mmpk, the layers appear:
self.mapView.map = mobileMapPackage.maps[0]
However, if you try and utilize the individual layers from the mmpk to a default AGSMap, but the layers don't appear. Here's the complete function for clarification:
if let filepath = NSBundle.mainBundle().pathForResource("mobile", ofType:"mmpk") {
print("found map")
let mobileMapPackage = AGSMobileMapPackage(path: filepath)
mobileMapPackage.loadWithCompletion { (error) -> Void in
if let error = error {
print(error.localizedDescription)
}
else {
// In this case the first map in the array is obtained
print ("setting map")
print("The mobile map package contains \(mobileMapPackage.maps.count) maps")
if (mobileMapPackage.maps.count > 0) {
var map = mobileMapPackage.maps[0]
print ("There are \(map.operationalLayers.count) layers.")
self.mapView.backgroundColor = UIColor.whiteColor() // will be hidden by basemap
self.mapView.map = AGSMap(basemap:AGSBasemap.lightGrayCanvasBasemap()) // required?
for obj in map.operationalLayers{
if let layer = obj as? AGSLayer {
print("Adding layer \(layer.name).") // the log shows them loading...
self.mapView.map!.operationalLayers.addObject(layer)
}
}
}
}
}
}Q3 & Q4 are related, I believe. I'm trying to minimize the data footprint distributed to my mobile devices, which all have to work completely offline. I'm really not wanting to include a basemap (to reduce size), and all I care about is showing the data from a few layers. Although there are no constraints on the mmpk export, the data is clipping weirdly on the device, and it's showing up on a solid black background:

Attempts to change the background color do not work -- the mmpk is actually inserting the black background on top of a mapview that has a solid green background color set.
This leads me to believe that a basemap is required to set extents properly.
Thoughts? Suggestions?