Select to view content in your preferred language

Loading .TPK File instead of Online Basemap

3409
7
Jump to solution
02-09-2021 08:18 AM
ArmandoGarcia3
Occasional Contributor

Hello Esri Community,

I know how to load a .TPK File instead of an online base map. I have used the sample esri application map maker in the past to make a small tpk map which puts it in a zip folder and I can just call that.

I have started to learn to use ArcGIS Pro and have began trying to make bigger maps. Do I just need to take the tpk files and put them in a folder and zip or can you just call the files?

This is where I am confused because the maps I've generated before came ready to go. The Maps I created on ArcGIS pro go inside my ArcGIS pro program so I am looking for guidance.

Can you help?

Cheers!

Tags (5)
0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

Armando:

 

If you are creating maps in ArcGIS Pro, the best way to open those in Runtime is to export the data to a Mobile Map Package - https://pro.arcgis.com/en/pro-app/latest/help/sharing/overview/mobile-map-package.htm 

Once you have a Mobile Map Package (.mmpk file) you can open in Runtime with the following code - https://github.com/Esri/arcgis-runtime-samples-qt/tree/master/ArcGISRuntimeSDKQt_CppSamples/Maps/Ope...

 

If you are wanting to only share a basemap, you can also create a TPK file directly in Pro with this tool - https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-map-tile-package.htm 

 

However, the Mobile Map Package has some advantages in that it retains the structure of your map, with operational layers and basemap layers, and it can be queried and interacted with like your map in Pro. A TPK is more static and loses individual attributes on features and such.

 

Long story short, if you just want a basemap, a TPK or VTPK will work great. If you want to bring your Pro Maps to Runtime, MMPK is the way to go.

View solution in original post

7 Replies
LucasDanzinger
Esri Frequent Contributor

Armando:

 

If you are creating maps in ArcGIS Pro, the best way to open those in Runtime is to export the data to a Mobile Map Package - https://pro.arcgis.com/en/pro-app/latest/help/sharing/overview/mobile-map-package.htm 

Once you have a Mobile Map Package (.mmpk file) you can open in Runtime with the following code - https://github.com/Esri/arcgis-runtime-samples-qt/tree/master/ArcGISRuntimeSDKQt_CppSamples/Maps/Ope...

 

If you are wanting to only share a basemap, you can also create a TPK file directly in Pro with this tool - https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-map-tile-package.htm 

 

However, the Mobile Map Package has some advantages in that it retains the structure of your map, with operational layers and basemap layers, and it can be queried and interacted with like your map in Pro. A TPK is more static and loses individual attributes on features and such.

 

Long story short, if you just want a basemap, a TPK or VTPK will work great. If you want to bring your Pro Maps to Runtime, MMPK is the way to go.

ArmandoGarcia3
Occasional Contributor

Lucas,

Thank you very much for that information.

0 Kudos
Amitkhillan
Emerging Contributor

Hello All,

Can you please provide suggestions for code below:

I have implemented below code snippet of Android ArcGIS for displaying the Basemap from cache(downloaded and saved in SD card) without having internet connection, but it is not working and displays the white map blank screen.

val tileCache1 =TileCache(externalCacheDir.toString() + folderpath")
val newTiledLayer1 = ArcGISTiledLayer(tileCache1)
map!!.basemap = Basemap(newTiledLayer1)
//mapView.setViewpoint(mapView.getCurrentViewpoint(Viewpoint.Type.CENTER_AND_SCALE))
mapView.map = map

Any Suggestions how to display Basemap offline from downlaeded .tpk file?

0 Kudos
LucasDanzinger
Esri Frequent Contributor

@Amitkhillan This is probably worth posting in the Android space as they may have a better idea what is going on

0 Kudos
Amitkhillan
Emerging Contributor

@LucasDanzinger  Thanks for the suggestion. Finally, I achieved the output which was required.

0 Kudos
RobertAnisoiu1
Occasional Contributor

Hello,


I am in the same situation. I try to display in an Android application a .tpk file.

Can you, please, help me with some advice. How did you succeeded to display the .tpk file? How did you said above, right now I have only a blank white screen with Esri logo in bottom-right corner and nothing else.

The code is below:

String base = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)+
"/myTPKFile.tpk";

TileCache tileCache = new TileCache(base);
ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(base);
Basemap basemap = new Basemap(tiledLayer);


ArcGISMap map = new ArcGISMap(basemap);
mmapView.setMap(map);


Thank you,

0 Kudos
ArmandoGarcia3
Occasional Contributor
Give me some time to go back and review what I did and I will see what worked for me.
0 Kudos