Tuesday, 14 April 2015

arcgis desktop - Unzipping geoprocessing package (GPK) file?


I was under the impression that all ArcGIS package files could have their contents examined and potentially used by renaming them to *.zip and unzipping them.


This impression is supported for map package (*.mpk) files by @KHibma's answer to Opening MPK file without ArcGIS Desktop? and I thought I had used it succesfully on geoprocessing package (*.gpk) files in the past.



However, today I am unable to use a tool within a *.gpk which I think is because it was created using ArcGIS Desktop 10.5.x when I am using 10.2.1.01. When I rename this *.gpk as *.zip and try to examine it in Windows Explorer I get:



Compressed (zipped) Folders Error


Windows cannot open the folder


The Compressed (zipped) Folder ....zip is invalid.



enter image description here


Is it possible to unzip a geoprocessing package (*.gpk) file to see whether it may contain some useful ArcPy code when that *.gpk cannot be unpacked to provide a usable toolbox?



Answer




Try .7z instead of .zip. the .*pk uses 7zip encoding and not zip.



Source - open a .*pk file in notepad++ or something and you will see the first characters are 7z. That is a 7zip header. Read more about the 7z file encoding here: http://cpansearch.perl.org/src/BJOERN/Compress-Deflate7-1.0/7zip/DOC/7zFormat.txt


Zip file headers start with a PK. Read more about zip encoding here: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...