GIS Logo GSP 118 (318): GIS Programming

ArcGIS Functions

In Review

There are a huge number of funcions available to Python scripts in ArcGIS. You'll probably never need most of them and there are many that effectively do the same thing. So, like the toolbox, one of the greatest challenges is just to find the function that does what you want. One of the easiest ways to find the function is to find it first in ArcGIS, use it, and then copy the Python code from the "results" window. As an example, if you execute and then copy the Python code from a "Buffer" operation, you'll see that it is labeled "arcpy.analysis_Buffer()".

Note: The calling sequence for a function that appears in the "Results" code is not always that same way to access it from outside ArcGIS. If you execute a "Slope" tool and copy the code, you'll see that the function is called with "arcpy.Slope_sa()". If you try to execute this code from Wing, it will not be able to find the function. The function is accessible through "arcpy.sa.Slope()".

Functions are organized in somewhat the same way as the toolbox with another set of functions specifically for scripting. Below is a list of the "packages" you'll probably use:

  • arcpy - main "Arc Python" package
  • arcpy.env - used to set environmental variables used throughout ArcGIS
  • arcpy.sa (Spatial analysis tools) - includes most of the raster processing functions
  • arcpy.anaylsis (Analysis tools) - contains most of the vector data processing functions
  • arcpy.mapping - used to access "mxd" docuemnts and the layers they contain (not the spatial data referenced by an mxd)
  • acrpy.management (Data management tools) - tools for coordinate systems (CRS), table management, etc.)

Most of the other toolboxes are represented as well and you can browse them by typing "arcpy." in Wingware or the in the Python Window in ArcGIS