Tile Package Properties

783
2
Jump to solution
06-19-2013 08:13 AM
MarcSwartz
New Contributor III
Is the "Access and Use Constraints" property of a Tile Package (.tpk) scriptable with Arcpy? If yes, hint or better please.

In the Catalog window right click on a .tpk file. select Properties and the following window is shown.

[ATTACH=CONFIG]25369[/ATTACH]
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ShaunWalbridge
Esri Regular Contributor
Marc,

I don't think there's a direct mechanism in ArcPy to edit that attribute, but it isn't too hard to do if you have some intermediate Python chops: the .tpk file is just a plain ZIP archive, and if you decompress the archive, you'll see a file, esriinfo/iteminfo.xml, which contains all of the settings, including that field, under the <licenseinfo> element. You could use the zipfile module in Python to extract the .tpk file, edit the XML file in Python using the included 'xml' module, and then save the full result set back to a new zip file. Not as easy as an additional parameter, but it'd do in a pinch.

cheers,
Shaun

View solution in original post

0 Kudos
2 Replies
ShaunWalbridge
Esri Regular Contributor
Marc,

I don't think there's a direct mechanism in ArcPy to edit that attribute, but it isn't too hard to do if you have some intermediate Python chops: the .tpk file is just a plain ZIP archive, and if you decompress the archive, you'll see a file, esriinfo/iteminfo.xml, which contains all of the settings, including that field, under the <licenseinfo> element. You could use the zipfile module in Python to extract the .tpk file, edit the XML file in Python using the included 'xml' module, and then save the full result set back to a new zip file. Not as easy as an additional parameter, but it'd do in a pinch.

cheers,
Shaun
0 Kudos
MarcSwartz
New Contributor III
Shaun,

   Thanks for the information.  I have verified that I can see all of the items you described.  Now for the fun of learning.

Marc