How do I include off-line basemaps to my mobile app

1281
8
03-29-2020 02:14 PM
TimConfare1
New Contributor II

I would like to "clip" existing basemaps to display along with my mmpk.  I was able to download osm tiles for the area I am interested in but I can't find any info on how or if I can bring that into my project.   I've also looked at the services like the World Light Gray Base (for Export) but there is no direction on how to add that as a local basemap.  I am developing in Qt with QML.  I am able to display my mobile map package data along with some locators but I can't get local basemaps to work.

0 Kudos
8 Replies
ErwinSoekianto
Esri Regular Contributor

Tim, 

In AppStudio, we are using ArcGIS Runtime SDK for Qt for all of the mapping capabilities. I think what you are looking to do is very similar to the "On Demand" offline workflow, where you can define an area of a map and control the map content to be taken offline, including the basemap. Please take a look at this documentation regarding Take a map offline - on-demand—ArcGIS Runtime SDK for Qt | ArcGIS for Developers 

Thank you,

Erwin. 

0 Kudos
TimConfare1
New Contributor II

Thank you for your reply.  Actually I do not want to have the maps downloaded on demand.  I want to package the maps, basemap, and locators to include with the app download.  I'm creating an app that will be used in areas that typically has spotty network access.   I read somewhere that this can be created in ArcGIS Pro (creating a .vtpk file for example) but I could never get it to work.

0 Kudos
ErwinSoekianto
Esri Regular Contributor

This sample shows you how to create and use the TPK file, which can be generated from ArcGis Pro, Generate offline map with local basemap | ArcGIS for Developers and here is the doc for TiledLayer, ArcGISTiledLayer QML Type | ArcGIS for Developers 

So it looks like you are having an issue creating the tpk or vtpk file from ArcGIS Pro‌ to be used as Runtime content, correct? 

0 Kudos
TimConfare1
New Contributor II

I was able to create a tpk file from ArcGIS Pro.  I just can't get it to show while using a mmpk.  Do I have to package it with the mmpk or can I put the tpk in a directory within my app and point the Basemap to it?  I've tried the former but I can't get the basemap to show.  No errors are returned either.

0 Kudos
MervynLotter
Occasional Contributor III

Hi Tim

You need to add the TPK to your map in ArcGIS Pro before creating the mobile package.  So the output of the MMPK will include your TPK and any other layers in the map.

It is best to ensure that the projection of the map matches that of the TPK before packaging.

ErwinSoekianto
Esri Regular Contributor

Tim, 

Nakul Manocha‌ and I tried this workflow you mentioned where we have both MMPK and TPK in an offline map.

Mervyn Lotter‌ is correct where we need to make sure to use the spatial reference for both MMPK and TPK 

This is the TPK (https://www.arcgis.com/home/item.html?id=3f1bbf0ec70b409a975f5c91f363fe7d ) and MMPK (https://www.arcgis.com/home/item.html?id=3453c82cf36149faa3e609e0dcbc3b95 ) that we used. They are both in 4326.

We modified the "Open Mobile Map (mmpk)" sample in AppStudio Desktop, where we were able to hide the default basemap in the MMPK and append an external TPK as basemap baselayer to the map. This modification is done in samples/MMPK.qml

Thank you,

Erwin & Nakul.

0 Kudos
TimConfare1
New Contributor II

Thank you for the reply.  I was not able to get this to work (I made sure the spatial references were the same).  However, I used your modification to hide or enable multiple basemaps that were included in my mmpk as a workaround.

Back to your example, instead of using the CopyLocalData function couldn't I just place the .tpk file in my directory structure and point the path to it?

0 Kudos
ErwinSoekianto
Esri Regular Contributor

Yes, you could just place the file in the folder where the app has access and read from it directly. 

So you were not able to make this work using your own MMPK and TPK? Did my sample work? I included the TPK and MMPK that you can download from ArcGIS Online. 

0 Kudos