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);
}
}
}
}
Solved! Go to Solution.
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):
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
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.
Tim,
Can you share your .vtpk with me?
Happy to take a look and see what I can figure out.
thanks,
Mark
Absolutely, how can I get it to you?
Thanks!
Tim
Can you share it through ArcGIS Online in a group and invite 'mark_nitro' to that group?
Thanks Mark! I just sent you an invite.
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
So you didn't do anything with the info folder? Is that folder not to be replaced?
Your modified version worked. Thank you!!
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.