Creating a good geoprocessing sample

Looking for 10.3 or Pro content?

Documentation and other resources for this ArcGIS capability can be accessed from http://desktop.arcgis.com, a new site focused on ArcGIS for Desktop users. In about three weeks we will begin redirecting to that page. Documentation for 10.2x and earlier releases will continue to be accessible.

Don't wait. Begin exploring now!

A geoprocessing sample is a .zip file containing files of interest to the geoprocessing community. You can add a geoprocessing sample to your MY CONTENT in ArcGIS Online.

The most typical content is a folder containing datasets, documents, and toolboxes. Geoprocessing samples are also how you deliver Python toolboxes and their associated documentation files (.xml).

If you're using ArcGIS 10.1 for Desktop, you should create a geoprocessing package (instead of a geoprocessing sample) and add and share the package to ArcGIS Online.

Below you will find information on how to consolidate your datasets, documents, and toolboxes into a single folder that is ready for compressing.

Consolidating your resources into a folder

The first step in creating a geoprocessing sample is to consolidate all your resources into a single folder.

For example, suppose you want to add and share a custom toolbox to ArcGIS Online. This custom toolbox contains a couple of models, and these models, in turn, use script tools you developed. In addition, your models use layers in a map document, and these layers reference datasets residing in different locations on your computer. In order to share your toolbox and tools, you need to gather together all the resources used by your tools (datasets, map documents, and so on) and put them in a single folder that you can compress into a .zip file. The process of gathering together all these resources into a single folder is called consolidation.

Consolidation requires that you copy or move datasets into one folder, reset the data sources for all your map layers and data elements within your models, and use relative paths to access all data.

For more information on how to perform your own consolidation, see the ArcGIS Desktop 10.0 help topic A quick tour of sharing tools and the checklist section below.

Geoprocessing packages at 10.1

If you're using ArcGIS 10.1 for Desktop, you should use a geoprocessing package to share your geoprocessing workflows rather than a geoprocessing sample.

Geoprocessing packages free you from having to do your own manual consolidation of resources. During the packaging process, ArcGIS automatically consolidates all required resources into a temporary folder, and this temporary folder is compressed into a package (.gpk). This automatic consolidation is both extensive and recursive. For example, if a tool uses other custom tools, these other tools are copied to the temporary folder and examined for dependencies. The same holds true for data; if a layer references a dataset that, in turn, has a relationship to other datasets, these other datasets are also copied and their dependencies examined.

Zip file structure and content

The ArcGIS Desktop 10.0 help topic A structure for sharing tools presents a folder structure, the ToolShare structure, that we recommend you use to consolidate all resources used by your tools. You then compress this folder into a .zip file to create your geoprocessing sample.

A folder built on the ToolShare structure is illustrated below. The root folder contains everything for your tools to execute. All resources must reside in the root folder or its subfolders.

Folder name

Description of contents

ToolData

Contains all data used by your tools. Typically contains file geodatabases, rasters, and layer files.

Scripts

Contains the scripts (.py files) for any script tools you submit.

Scratch

This directory can be used for writing intermediate data in models and scratch data in scripts. It typically contains a file geodatabase named scratch.

Doc

Contains anything that helps the user understand the delivered tools such as PDF files, compiled help files (.chm), or Word and PowerPoint documents. Also contains any images used in model diagrams.

A geoprocessing sample uploaded to ArcGIS Online is a .zip file containing a root folder, as illustrated below. When you create your .zip file, be sure to add just the root folder, not the individual contents of the root folder.

Checklist

Here is a checklist (PDF file) to help you create a good geoprocessing sample.