Friday, July 20, 2012

The Tile Package

What is it?
New at 10.1, tile packages are compressed files that contain a map document's cached data.  The tile package or .tpk is ideal for disconnected use and for sharing information to ArcGIS Online.
Why Should I Care?
It makes sharing cache easy, and you can create custom caches on the fly.  From a geoprocessing/application view of things, this means you can get your data out to mobile users without needing an air card.  It also produces an easy way to share cache from server to server or AGOL.

Other reasons include:
  • Improved rendering performance
  • Improved quality
  • Follows industry standards (AGOL, Google, Bing, etc..)

You can create a package using geoprocessing as follows:
import os
import arcpy
from arcpy import env
# Set environment settings
env.overwriteOutput = True
env.workspace = "C:/Tilepackages/"
# Loop through the workspace, find all the mxds and create a tile package using the same name as the mxd
for mxd in arcpy.ListFiles("*.mxd"):
    print "Packaging " + mxd
    arcpy.CreateMapTilePackage_management(mxd, "ONLINE",
                                       os.path.splitext(mxd)[0] + '.tpk',   "PNG8", "10")
Pretty easy to create.  It should be noted that your ArcMap Document's extent determines the area to be processed.  You can embed web service layers as well as local data.  The cached is fused together and it means you cannot query the base data as well.

Have packaging