A quick tour of creating tools with Python
Geoprocessing system tools (those installed with ArcGIS) are designed to perform one small but essential operation on geographic data. Using ModelBuilder or Python, you execute these geoprocessing tools in a sequence, feeding the output of one tool to the input of another. The script you create may be an essential part of your workflow—a task you need to repeat again and again.
Scripts that you create can be executed with one of two basic methods: outside ArcGIS and within ArcGIS.
- Outside ArcGIS means that the script is executed from the operating system command prompt, as shown below, or within a development application, such as PythonWin. Scripts executed in this manner are referred to as stand-alone scripts.
Running a script from a cmd window.
E:\ScriptLib>transform_data.py "e:\data\d052573
- Within ArcGIS means you create a script tool inside a toolbox. A script tool is like any other tool—it can be opened and executed from the tool dialog box, used in models and the Python window, and called from other scripts and script tools.
Geoprocessing tools can be created from Python in two ways: standard toolboxes, () where you connect a Python script tool to a toolbox using a wizard, and Python toolboxes (), which are an ASCII file written entirely with Python code. To learn more about the differences between custom and Python toolboxes, see Comparing custom and Python toolboxes.