How to display a local basemap (.vtpk) with a Mobile Map Package

3834
19
Jump to solution
09-21-2020 06:52 PM
TimConfare1
New Contributor II

Whatever I try I cannot get a basemap to show with a Mobile Map Package.  I would rather show a local vtpk instead of an esri online basemap.  Here is my code:

Item {
    anchors.fill: parent
    signal openMenu()
    property string searchPane: ""
    property string inputdata: "ZooScapeMKE.mmpk"
    property string locatorFileName: "Locator-MKE.loc"
    property string filePath: "../data/"
    MapView {
        id: mapView
        anchors.fill: parent
        focus: true
    }
    MobileMapPackage {
        id: mmpk
        path: filePath + inputdata
        Component.onCompleted: {
            mmpk.load();
        }
        onLoadStatusChanged: {
            if (loadStatus === Enums.LoadStatusLoaded) {
                mapView.map = mmpk.maps[0];
                console.log(mapView.map.spatialReference.wkid);
                mapView.map.minScale = 15000;
                mapView.map.maxScale = 1000;
                var basemapLayer = ArcGISRuntimeEnvironment.createObject("ArcGISVectorTiledLayer", {url: filePath + "BasemapGrayMKE.vtpk"});
                mapView.map.basemap.baseLayers.append(basemapLayer);
            }
        }
    }
}
19 Replies
TimConfare1
New Contributor II

Hi Mark,

I created a vtpk using the gray basemap, went to the directory it was download to, unzipped it, replaced the files in the info, sprites, and styles directories from the resource link you sent, zipped it back up and then added it to my maps and this is what I get (as you can see there is no info for spatial reference which was there in the original basemap):

0 Kudos
MarkBockenhauer
Esri Regular Contributor

hey Tim,

hmm...   what did you use to zip the the content back up?

I use 7zip  https://www.7-zip.org/ 

with these settings

0 Kudos
TimConfare1
New Contributor II

I used the same zip app and settings you did except the "Number of CPU threads" was 2 / 2.  Other than that it was identical.

0 Kudos
MarkBockenhauer
Esri Regular Contributor

Tim,

Can you share your .vtpk with me?

Happy to take a look and see what I can figure out.

thanks,

Mark

0 Kudos
TimConfare1
New Contributor II

Absolutely, how can I get it to you?

Thanks!

Tim

0 Kudos
MarkBockenhauer
Esri Regular Contributor

Can you share it through ArcGIS Online in a group and invite 'mark_nitro' to that group?

0 Kudos
TimConfare1
New Contributor II

Thanks Mark!  I just sent you an invite.

0 Kudos
MarkBockenhauer
Esri Regular Contributor

Tim,

I shared a modified version of it back into the group (lightgraybase).  In the resources folder I  just swapped the root.json folder in the styles folder and the content in the Sprites folder (from the resources.zip that I referenced earlier) and re-zipped the .vtpk.

If you share your broken one, I might be able to see what is wrong with it.

Mark

0 Kudos
TimConfare1
New Contributor II

So you didn't do anything with the info folder?  Is that folder not to be replaced? 

Your modified version worked.  Thank you!!

0 Kudos
MarkBockenhauer
Esri Regular Contributor

no, I did not modify the info folder.  The info folder is all of the font references.   It is possible that the fonts could not be quite the same, if the external style is making use of a font that is not in the internal style.

0 Kudos