Hello,
We are trying to create a .tpk file from a tile cache folder using arcpy and arcgis 10.1. We created the tile cache in python using “arcpy.ManageTileCache_management” and this works great. arcpy.ManageTileCache_management produces a cache folder with the expected resolution level folders; ie, L00- L14. However, when we call ExportTileCache immediately after from the same python script and use the tile cache folder as the source we get the following error:
ERROR:root:ERROR 999999: Error executing function. The workspace is not connected. Failed to execute (ExportTileCache)
Sample code:
arcpy.ExportTileCache_management("C:\Users\test\AppData\Roaming\tpkgen\tpkgen_cache", “C:\Users\test\AppData\Roaming\tpkgen”, "tpkgen_result", "TILE_PACKAGE", "COMPACT", scales)
Where tpkgen_cache is the tile cache created using ManageTileCache.
As a side note we can run the ExportTilePackage from ArcToolBox using tpkgen_cache as the input it works fine and produces a .tpk file as expected.
Does anyone have insight into this?
Thanks.
i don't have access to test right now, but try
arcpy.ExportTileCache_management(r"C:\Users\test\AppData\Roaming\tpkgen\tpkgen_cache", r“C:\Users\test\AppData\Roaming\tpkgen”, "tpkgen_result", "TILE_PACKAGE", "COMPACT", scales)
Notice the small r before the path strings. For one discussion of various ways to write paths, see this poll's comments
if that doesnt work, since you said the tool works, after running it, go to you results tab, right click on the completed to and copy the Python snippet. Paste this into you Python script (or window) to see the format the command it wanting.