Post date: Oct 07, 2014 10:28:38 PM
I converted the unzip.py script to a Python Toolbox today. The source script had accidentally been deleted from its original location and I thought it had been lost forever. Python toolboxes store the script source inside the toolbox preventing this type of disconnect. More details on how the unzip GP service works:
1. File uploads must be enabled on the Unzip GP service. This is done using ArcGIS Server Manager
2. Use the esri.request Javascript API on a web page to upload the zip file to the server. (generateFeatureCollection method)
3. Esri.request returns a hex ID to identify the uploaded file on the server. Provide this as input when calling the Unzip GP service (uploadSucceeded method)
4. The Unzip GP service returns a Feature Set containing the features that were in the original zipped Shapefile. Process the results as desired (gpJobComplete method)
(Note: Javscript method names refer to the .aspx web page attached to this post. A working copy of the page is also available online.
Alternatively you can test the GP service manually using the REST endpoint:
1. Navigate here to upload a shapefile
2. Save off the Item ID that is returned. As noted in step 3 above, ArcGIS server uses this ID to locate the uploaded file
3. Use this url to call the Unzip GP service. Provide the item ID as an argument in this format: {"itemID": "i0f2d6f8e-c856-482b-b0fd-3287cb37b77d"} substituting your item ID in the example
4. Submit the job. Unzip is an asynchronous GP service so you'll need to hit the 'Check Job Details' button to monitor the status
5. When the job completes, you should have a JSON representation of the features that were in the original shapefile
A copy of the script can be found on atlas at: C:\GIS\Geoprocessors\webgis\UnzipShapefile.pyt
Note: There appears to be some sort of bug with the Python GPFeatureRecordSetLayer parameter type in ArcGIS 10.2.2. The script returned no output parameters when using this data type. When I switched it to DEFeatureClass, everything worked fine.