Display mmpk Issues

462
2
12-18-2019 08:26 AM
jaykapalczynski
Frequent Contributor

I created a mmpk as follows...this has been all through testing...

1. created a TPK with aerials

2. I then took the tpk and added contour lines and created the mmpk...

When I use the Quick Report template and point the offline button to this mmpk it draw the aerials and contour lines fine...everything looks great.

But I have a separate page that I am trying to show this mmpk file on and ONLY the aerials show up...the contours are not showing....I imagine only the first index in the mmpk is drawing?  NO idea here.

I am trying to show this .mmpk in a few different ways but neither shows the contour lines....is there something that I am missing.  In the Quick report template there is code for a   MobileMapPackage {  but not in my second page.  NOTE that I have a few mmpk files and 2 tpk files that I want the user to be able to display.  Right now just trying to get the mmpk file to draw correctly with the contours.

ListModel {
        id: tpkList

        ListElement { text: "Second TPK Basemap"; map: "file:///storage/82FF-66AD/Android/data/QuickReport/backgrounddatammpk.mmpk" }
        ListElement { text: "Second TPK Basemap"; map: "file:///storage/82FF-66AD/Android/data/QuickReport/District_23.mmpk" }
        ListElement { text: "Second TPK Basemap"; map: "file:///storage/82FF-66AD/Android/data/QuickReport/sd.tpk" }
        ListElement { text: "Second TPK Basemap"; map: "file:///storage/82FF-66AD/Android/data/QuickReport/District41_100Ft_Contours.mmpk" }
}

Basemap {
   id: basemap
}

// OR 

Basemap {
   id: basemap
   ArcGISTiledLayer {
      url: tpkList.get(3).map
   }
}

// OR

Basemap {
   id: basemap
   MobileMapPackage {
      path: tpkList.get(3).map
   }
}

 

0 Kudos
2 Replies
ErwinSoekianto
Esri Regular Contributor

Jay, 

That is weird because it is showing correctly on another page in the same app. Perhaps you can look at the code on that other page that is working? 

Or they are different workflows on loading the MMPK files. does the offline button in QuickReport point to ArcGIS Online item that has the MMPK file instead of pointing to MMPK files on disk? 

Thank you,

Erwin

0 Kudos
jaykapalczynski
Frequent Contributor

Yea this one is puzzlin me...

As you can see from the two wexamples below I am pointing to the same mmpk file on the storage card.

file:///storage/82FF-66AD/Android/data/com.xxxx.background.data/QuickReport/backgrounddatammpk.mmpk

On the RefineLocationPage.qml page from the Quick report Template I am pushing the path to my Storage Card

RefineLocationPage.qml file

        MobileMapPackage {
            id: mmpk
            path: app.mmpkManager.fileUrl1
            onLoadStatusChanged: {
                if (loadStatus === Enums.LoadStatusLoaded) {
                    mapView.map = mmpk.maps[0];
                    isOfflineMap = true;
                    if(refineLocationPage.currentExt){
                        mapView.setViewpointGeometry(refineLocationPage.currentExt);
                    }
                }
            }
        }

MmpkManger.qml file to GET the propoer path/url to the file

    property string subFolder: "QuickReport"
    property string itemName1: "backgrounddatammpk.mmpk"
    property url fileUrl1: [fileFolder1.url, itemName1].join("/")
    FileFolder{
        id: fileFolder1
        readonly property url storageBasePath: "file://" + "/storage/82FF-66AD/Android/data/" + "com.xxxx.background.data"
        property url storagePath: subFolder && subFolder>"" ? storageBasePath + "/" + subFolder : storageBasePath
        url: storagePath
    }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

On my second page I am simply displaying the mmpk file as an ArcGISTiledLayer as such

The reason I have it set up this way is that I have a button that allows the user to click through a few basemaps.

    ListModel {
        id: tpkList

        ListElement { text: "Second TPK Basemap"; map: "file:///storage/82FF-66AD/Android/data/com.xxxx.background.data/QuickReport/backgrounddatammpk.mmpk" }
        ListElement { text: "Second TPK Basemap"; map: "file:///storage/82FF-66AD/Android/data/com.xxxx.background.data/QuickReport/District_23.mmpk" }
        ListElement { text: "Second TPK Basemap"; map: "file:///storage/82FF-66AD/Android/data/com.xxxx.background.data/QuickReport/Richmond.tpk" }
        ListElement { text: "Second TPK Basemap"; map: "file:///storage/82FF-66AD/Android/data/com.xxxx.background.data/QuickReport/District41_100Ft_Contours.mmpk" }

    }

Basemap {
   id: basemap
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Component.onCompleted: {
    var tpkPath = tpkList.get(0).map
    var tpkBasemap = ArcGISRuntimeEnvironment.createObject("ArcGISTiledLayer", {url: tpkPath});
    basemap.baseLayers.clear();
    basemap.baseLayers.append(tpkBasemap);
}
0 Kudos