TPK Files not working

5327
15
Jump to solution
10-27-2016 01:42 PM
Hernando_CountyProperty_Apprai
New Contributor III

I have built a a tile cache using the Manage Tile Cache tool in ArcMap 10.3.1.  I use RECREATE_ALL_TILES as the Manage Mode and ARCGISONLINE_SCHEME as the Input Tiling Scheme.  I create only the top 6 levels and I use an area of interest for a small area.   I then use the Export Tile Cache tool to create a tpk file but when I try to use this in Survey 123 it doesn't show up.  It seems like the only way a tpk file works is if I create it using the share as option and create a tile package.  But this doesn't allow me to to use an area of interest which results in a huge file that draws so slow you couldn't use it!  Can anyone offer any suggestions?  I will eventually have to use all 20 levels so the tpk will be even larger and slower.

0 Kudos
1 Solution

Accepted Solutions
JamesTedrick
Esri Esteemed Contributor

Hi, I've tracked down the cause of the issue- there's a mismatch in the name of directory Survey123 expects the tiles to be inside the tpk and the actual name used inside the tpk.  Until the issue is addressed, this would be a workaround for using tpk files generated by Export Tile Cache tool; it requires you have 7zip installed:

  1. Generate the tpk file using the Export Tile Cache tool
  2. In Windows Explorer, right-click on the tpk file, select '7zip > Open Archive'
  3. In the 7zip window, double click into the servicedescriptions folder and then double-click into the map server folder
  4. You should see a mapserver.json file; right-click on the file and select 'Open'
  5. Look for the entry "mapName" and copy the value.  In the image below, it is 'Map22'
  6. In the 7zip window, proceed up (icon to the left of the adds) until you get back to the root of the tpk file.  Double-click into the 'v101' folder.
  7. You should see a directory with a name that is not the same as the mapName value from step 5.  Rename it to the mapName value and then close 7zip.  The file should now be readable by Survey123.

View solution in original post

15 Replies
JamesTedrick
Esri Esteemed Contributor

Hi there,

I'm able to reproduce the issue you are describing and we'll add it to the issues list.  If you have an ArcGIS Server, a TPK generated from a cached Map Service using the 'Export Map Server Cache' tool successfully works and also allows for an area of interest.

0 Kudos
Hernando_CountyProperty_Apprai
New Contributor III

Thank you James.  I've also noticed a major problem when I do create a tpk file using the Share As option using all levels.  I need to cache down to the building level as we are doing damage assessments and must see the buildings on our aerials.   We also need to be able to see our parcels and addresses so the person who is doing the damage assessment can reference them on the map. We need the base map disconnected because we have areas in our county that do not have service ever, and if there was a major disaster, chances are there won't be service in many other areas.  My tpk file is 35GB.  I was not able to publish my survey if I put this file in the media folder and I can understand that...pushing 35GB over the internet would be an issue.  

So I moved the tpk file to my media folder in Survey123 Connect and set my default map for the survey to it.  Before publishing, I removed the tpk file.  In this way, it published my survey to ArcGISOnline but didn't try to upload the actual tpk file.  

When someone downloads the survey, it's still pointing to the tpk file as the default map and I can manually move the tpk into the media folder of the survey.  

However, when I use the survey, the map is extremely slow,   To the point where it draws one tile, then waits for 10 - 20 seconds, then draws another tile etc.  I'm assuming that since it's using a tpk file, it is having to expand it first in memory before it can access each tile that I need.  Since the file is so large, this is what is causing the slow down, is it not?  I realize that Survey 1-2-3 only works with tpk files but to make this actually work the way it should (which SHOULD be faster than accessing it on the web), are there any plans to have Survey 1-2-3 work with the actual tiles?  In this way, I would be able to export the tiles from the tpk once which should make it work a lot faster.

What I would really like to see is that I can have a survey that works both offline and online with both the feature layer and the basemap.  ESRI makes it seem like this works because if you ask them if it works offline they will tell you yes it does.  And technically speaking, they are right.  The feature layer does work offline and I can plot points as needed whether I am connected or not.  But practically speaking, it doesn't work because if I have no basemap to use a reference when I'm disconnected, how can I possibly know where I want to put the point?  In most cases for a damage assessment, just getting my current lat/long won't work unless I'm standing on the site of the building.  That's all well and good, but what if the building is no longer there???  This happened in Louisana where houses just floated away.

0 Kudos
DougBrowning
MVP Esteemed Contributor

I build a lot of these.  I have found that the Create Map Tile Package is the only one that works fully.  Its slow but works pretty much every time.  Make sure to use Mixed.  

I have 5 open bugs with Esri on this but they have been open over a year with not fix so far.  

If you want lots of detail check out this post  https://community.esri.com/people/Yovavzsystematics-co-il-esridist/blog/2014/08/26/cache-and-tpk-wit... 

zkovacs
Occasional Contributor III

You are not alone with this, we also need to provide tile packages for projects with less than 20 levels (or with more zoom levels than 20). This thread discusses a similar issue - probably affected by the same bug(s). I'm yet to hear back whether the team had any time to look at the samples they requested... Haven't had a chance to test it with the latest build (1.8), but probably wouldn't be any difference. Hopefully it will be fixed soon as it could be a deal-breaker for us.

0 Kudos
Hernando_CountyProperty_Apprai
New Contributor III

This is what finally worked.  Taking James' suggestion, I created a map service and created a map tile cache for all levels (down to 1128 - Building).  I then used the Export Map Server Cache as suggested to create the tpk file.  This also lets you use an area of interest but I didn't do that.  The resulting tpk file was 4GB and ran MUCH faster in my surveys.  

Why does the Share As Tile Package take 24+ hours to create cache and creates a file that is 35GB when it only takes 1 hour to create the map server cache and the Export Map Server Cache creates a tpk file that is only 4GB?  Seems there is a bug in this process.  ESRI, please change your tutorial for creating offline maps so that the process is to create map cache and then Export Map Server Cache.  I've been working on trying to get this to run faster for 2 weeks now and doing it this way solved my problem.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi, I've tracked down the cause of the issue- there's a mismatch in the name of directory Survey123 expects the tiles to be inside the tpk and the actual name used inside the tpk.  Until the issue is addressed, this would be a workaround for using tpk files generated by Export Tile Cache tool; it requires you have 7zip installed:

  1. Generate the tpk file using the Export Tile Cache tool
  2. In Windows Explorer, right-click on the tpk file, select '7zip > Open Archive'
  3. In the 7zip window, double click into the servicedescriptions folder and then double-click into the map server folder
  4. You should see a mapserver.json file; right-click on the file and select 'Open'
  5. Look for the entry "mapName" and copy the value.  In the image below, it is 'Map22'
  6. In the 7zip window, proceed up (icon to the left of the adds) until you get back to the root of the tpk file.  Double-click into the 'v101' folder.
  7. You should see a directory with a name that is not the same as the mapName value from step 5.  Rename it to the mapName value and then close 7zip.  The file should now be readable by Survey123.
Jean-YvesLandry1
Occasional Contributor

I tried your methodology but it still does not appear in the geopoint maps.  The mapName appears Map then I changed the folder and the .lyr name to Map to no avail.  Should I change the name in the v104 folder as well?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Jean-Yves,

It's much better to change the mapName value than the others- there may be linkages in the other files that we cannot edit that rely on the name of the directories.

0 Kudos
Jean-YvesLandry1
Occasional Contributor

The only way I've been able to build a working basemap for survey123 has been with File>ShareAs>Tile Package methodology.  However this only works if I use the tile Scheme "Arcgis Online / Bing Maps / Google Maps" for the TPK.  The problem is that only creates tiles up to 1:1,128.  When I create a custom scheme the tpk is created and works in collector but it does not appear in survey123.  Not sure what the issue is, I've tried all the methodology described here.  Anyone had luck creating a scale of about 1:500 for their survey123 map?

0 Kudos