Lucas Danzinger A few questions. I'm using this code:
MapView {
id: mapView
anchors.fill: parent
focus: true
Map {
id: map
BasemapTopographic{}
}
function unpackMmpk(path, outputDirectory) {
// once the unpack status is complete, add the mmpk
MobileMapPackageUtility.unpackStatusChanged.connect(function() {
if (MobileMapPackageUtility.unpackStatus === Enums.TaskStatusCompleted) {
console.log("unpacked mmpk");
addMmpk(path);
} else if (MobileMapPackageUtility.unpackStatus === Enums.TaskStatusErrored) {
console.log("unpacking TaskStatusErrored");
}
});
console.log("unpacking mmpk");
// unpackage the mmpk
MobileMapPackageUtility.unpack(path, outputDirectory);
}
function addMmpk(path) {
console.log("adding mmpk");
// create the mmpk and set the path
var mobileMapPackage = ArcGISRuntimeEnvironment.createObject("MobileMapPackage");
mobileMapPackage.path = path;
// wait for the package to load
mobileMapPackage.loadStatusChanged.connect(function() {
if (mobileMapPackage.loadStatus === Enums.LoadStatusLoaded) {
// set the mapview's map to the first map in the package
mapView.map = mobileMapPackage.maps[0];
}
});
// load the mmpk
mobileMapPackage.load();
}
Component.onCompleted: {
unpackMmpk("/tmp/goldstream_valley.mmpk", "/tmp/unpacked")
}
}
MobileMapPackageUtility.unpack() requires the mmpk file as the first argument and the directory to unpack as the second, so I updated that. I also added a test to see if there's an error unpacking.
When I run this, I see "unpacking mmpk" in the logs, it never reaches "unpacked mmpk" or "adding mmpk", but it does hit the "unpacking TaskStatusError" section. But I don't know what might be going wrong. The "unpacked" directory exists and I can write to it, and the mmpk file unzips just fine with the Unix "unzip" utility.
Any suggestions as to what I might be doing wrong or how to have it show me the error? Once I get it unpacked, I'm wondering whether I need to pass the unpack directory to the addMmpk() function rather than the mmpk file itself.
Finally, all I'm really trying to do is get a TIF image as the background for my map. Is there a simpler way to accomplish this? It seems like a lot of work to create a mobile map package of a TIF, then have the application unpack it back into a TIF again for display.
Thanks!