Customer Service | Training | Contact Us
Welcome!
Login
Search Options   products areas display

Which products should be considered?

All Products

ArcCAD
ArcEditor
ArcExplorer
ArcGIS Engine
ArcGIS Explorer
ArcGIS Image Server
ArcGIS Mobile
ArcGIS Server
ArcIMS
ArcInfo Desktop
ArcInfo Workstation
ArcLogistics Route
ArcPad
ArcPad Application Builder
ArcReader
ArcSDE
ArcView
ArcView 3.x
ArcWeb Services APIs
ArcWeb Toolbar for ArcGIS
Atlas GIS
BusinessMap
BusinessMap Pro
GIS Portal Toolkit
Job Tracking for ArcGIS
MapIt
Maplex
MapObjects -- Java
MapObjects -- Windows
MapObjects IMS
MapObjects LT
MapStudio
Military Overlay Editor
NetEngine
PC ARC/INFO & DAK
PLTS
RouteMap
RouteMap IMS
SDE
Tracking Server

    Remember these settings for each visit More info
You are here:

Technical Article   HowTo:  Get started writing Python geoprocessing scripts in ArcGIS 9x

Article ID: 30028
Software:  ArcGIS - ArcEditor 9.0, 9.1 ArcGIS - ArcInfo 9.0 ArcGIS - ArcView 9.0, 9.1
Platforms:  Windows 2000, XP

Summary

Geoprocessing tasks can be time intensive since they are often performed on a number of different datasets or on large datasets with numerous records. Scripting is an efficient method of automating geoprocessing tasks.

Instructions provided describe the resources available to help get started using Python scripting for geoprocessing.

Procedure

Below is a list of resources for writing geoprocessing scripts using Python.

  • Read the 'Writing Geoprocessing Scripts' PDF white paper. This is located on the ESRI Library CD and is entitled Writing_Geoprocessing_Scripts.pdf. This PDF provides an overview of writing geoprocessing scripts.
  • Print the Geoprocessing Object Model; a link to this model is located in the ArcGIS Desktop Help. -show me-

    1. Start the ArcGIS Desktop Help by navigating to Start > Programs > ArcGIS > ArcGIS Desktop Help, or select Help from within ArcMap or ArcCatalog.
    2. In ArcGIS Desktop Help, select the Contents Tab and then navigate to Geoprocessing > Automating your work with scripts > Scripting Object: Properties and Methods. Select Geoprocessor programming model.
  • Details and samples for all the Scripting Object properties and methods can be found in the ArcGIS Desktop Help. -show me-

    1. Start the ArcGIS Desktop Help by navigating to Start > Programs > ArcGIS > ArcGIS Desktop Help, or select Help from within ArcMap or ArcCatalog.
    2. In ArcGIS Desktop Help, select the Contents Tab. Navigate to Geoprocessing > Automating your work with scripts > Scripting Object: Properties and Methods. Select Properties and Methods.
  • There are several places to find Python syntax for each geoprocessing tool:
    • Quick reference guide located on the ESRI Library CD entitled Geoprocessing_Quick_Ref_Gde.pdf.
    • More detailed information and samples for each geoprocessing tool can be found in the ArcGIS Desktop Help. -show me-

    1. Start the ArcGIS Desktop Help by navigating to Start > Programs > ArcGIS > ArcGIS Desktop Help, or select Help from within ArcMap or ArcCatalog.
    2. In ArcGIS Desktop Help, select the Contents Tab > Geoprocessing Tool Reference.

    Here is located a subtopic for each toolbox in ArcToolBox containing sub topics for each toolset. Within each toolset subtopic, there is a tool subtopic with documentation and Python samples for each tool.
  • Since Python is not an ESRI product, it is recommended use non-ESRI resources such as Python's website, www.Python.org, and the 'Python in a Nutshell' and the 'Learning Python' books published by O'Reilly. Essential non-ESRI Python syntax is also described in the "Writing Geoprocessing Scripts" pdf.
  • Knowing how to export a model to a script is very useful. -show me-

    1. Create models to do some or all of what the scripts do.
    2. Export the model to a Python script and the Python code is essentially written automatically.
    3. Open the script in PythonWin to make modifications it. For example, adding looping and conditional statements.

    Another reason to know how to export models to scripts is to see the correct syntax for tools. Export a model to a script from within the model builder window. Click Model > Export > To Script > Python.
  • One of the most common tasks is to repeat run a geoprocessing operation. See the link in the Related Information section below.
  • Additional training is available from ESRI and ESRI-authorized instructor-led classes as well as by way of the ESRI Virtual Campus. See the link in the Related Information section below for more information about ESRI Training and Events.

Related Information


Created: 11/29/2005
Last Modified: 1/4/2010

This website's graphical display is now viewable only with W3C standards-compliant browsers, but the content is accessible to all browsers and Internet devices. View our supported browser matrix for more information on our website display.