Find resources to web sites about Python scripting to use in GIS. Learn how to use Python to expand your geographic information system. Esri uses Python as its scripting language for ArcGIS and the language can be found in many open source GIS applications. Also see: Learning Programming for GIS for general Python resources.
Python is a scripting language incorporated into many GIS software applications such as ArcGIS and QGIS and is used to automate geoprocessing tasks. Python scripts are essentially a command-based script containing data types, statements, and functions that make up the geoprocessing instructions. Python files are denoted with the .py file extension.
Using Python in ArcGIS
Within ArcGIS, there are two options for working with and running python scripts: directly within ArcMap using the python window, or within an Integrated Development Environment (IDE) such as PythonWin.
Python can be run directly within ArcGIS by clicking on the Python button found on the standard toolbar. By clicking the button, ArcMap’s python window opens. The python window can be docked by dragging it to the toolbar or can be floated on top of ArcMap. The python window is divide into two sections: the python prompt section and the help and syntax window. The python prompt is found on the left side of the python window and this is the section where python prompts can be typed into or python scripts run. The right side of the window provides information with syntax information that show up when a command is typed in on the left side.
To load a prewritten script into the python window, right click and select the “load” option from the menu. Navigate to the folder where the python file is store and select. Click the “open” button to add the script to the window.
To run a loaded script, hit the “enter” button on the keyboard twice. The right side will now print out status updates on the running script. Running a python script within ArcMap allows the user to see dynamically the results of the outputs as the script processes each geoprocessing step.
Python scripts for ArcMap processes can also be edited and run within an IDE. IDE stands for Integrated Development Environment. IDEs for python scripting include IDLE, PythonWin, PyScripter, and Wing.
For further learning materials, Esri has compiled a Python for ArcGIS page which provides a variety of Esri-based and individually created resources for learning python including a beginner’s guide, tutorials, and sample scripts.
A Guide to the Python Universe for ESRI Users (PDF File)
Overview and guide for GIS users to Python by Howard Butler from Iowa State University.
Using Python in QGIS
QGIS is an open source GIS which incorporated python as a scripting option starting with release 0.9. The PyQGIS cookbook provides a good introductory text on how python is used with the QGIS environment. The QGIS blog also has a list of QGIS tutorials in Python.
Open Source GIS and Python
Geoprocessing with Python using Open Source GIS
Structured course outline by Chris Garrard of Utah State University with links to open source software, course slides, and data.
Geocoding toolbox for Python. Provides support for six geocoders: Google Maps, Yahoo! Maps, Windows Local Live (Virtual Earth), geocoder.us, GeoNames, MediaWiki pages (with the GIS extension), and Semantic MediaWiki pages.
Python Cartographic Library
The Python Cartography Library, or PCL, is a package of modules for rendering GIS data from a variety of backends into maps. Open source.
Python and GIS 101
From Sean Giles’ blog.
Unofficial Python GIS SIG
Discussion group for GIS developers using Python with a focus on exchanging ideas and peer support.
Python for ArcView 3.x
Using Python with ArcView 3.x
Resources for using Python with ArcView 3.x software. Also contains links to Python examples and resources.
Python language support for ArcView 3.x software which allows you to embed Python within ArcView 3.x
Other Legacy GIS Python Usage
Python code samples for GIS mostly involving USGS SDTS DEM files.