GIS Lounge


  • Home
  • What is GIS?
  • GIS Career
  • Learn GIS
  • Maps
  • Contact

You are here: Home » GIS Software » GIS Programming » Python and GIS Resources

Python and GIS Resources

Filed in GIS Programming by Caitlin Dempsey on October 19, 2012 • 3 Comments

Share this article:

Related Content:

QGIS versus ArcGIS Learning GIS Programming

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.

Geopy
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.

AvPython
Python language support for ArcView 3.x software which allows you to embed Python within ArcView 3.x

Other Legacy GIS Python Usage

Code Samples
Python code samples for GIS mostly involving USGS SDTS DEM files.

Suggest a resource: editor@gislounge.com

You Might Also Be Interested In:

  • Learning GIS ProgrammingLearning GIS Programming
  • Open Source GIS and Freeware GIS ApplicationsOpen Source GIS and Freeware GIS Applications
  • Languages and Operating Systems in GISLanguages and Operating Systems in GIS
  • C and C++ ProgrammingC and C++ Programming


Tags: arcgis, geocoding, GIS analysis, open source gis, Programmer/Developer, Python, QGIS



Comments (3)

Trackback URL | Comments RSS Feed

Sites That Link to this Post

  1. Learning Programming for GIS | GIS Lounge | October 13, 2010
  1. nadeem kazmi says:
    September 23, 2010 at 2:21 pm

    Please help me to fix the error. The end quotation.
    thank you
    nadeemgis@gmail.com

    Error line , quotation

    print “The freeway buffers have been created.”

    #Date Created: 09/14/2010
    # Purpose: Create a feature class of SDMTS trolly stops within 0.25 miles ( 1320 feet) of a freeway
    # Import Arcgis scripting module, create the Geoprocessor object, and specify the workspace and toolbox
    import argisscripting
    gp = arcgisscripting.create()
    gp.workspace = “C:\Temp\nadeem_python\SanDiegoData\SanDiego.gdb”
    gp.toolbox = “analysis”

    # Buffer freeways by 0.25 milrd (1320 feet).
    gp.buffer(“freeways”, “Freeway_Buffers”, 1320)
    print “The freeway buffers have been created.”
    # Intersect trolley stops with freeway buffers to output stops within 0.25 miles ( 1320 feet) of a freeway
    gp.Intersect_analysis(“trolleystop ; Freeway_Buffers” , “StopsNearFreeways”)
    print “The intersect was completed.”

    Reply
  2. Christoph Correia says:
    January 12, 2013 at 8:26 am

    Hi, I wonder if you can help me with something I want to progam. So:
    How can I write a program using python, that calculates some morphometric and drainage indexes using numeric attributes in the attribute table with ArcGIS?

    The data I have in my table are area and perimeter of the basin, and channel order of the watercourses (number and km of each order).

    For example, I need to calculate the Relationship of bifurcation with this formula: RB=Nu/Nu+1 (Nu – considered channel order; Nu+1 – channel order immediately ) above the considered one).

    So, I want to create a program that would be able to get the right value from the attribute table (in ArcGIS) and run with the formula. How can I do that?

    Thanks

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

« Dos and Don’ts of Web Map Design
Here Be Dragons »

Subscribe

Fill out your e-mail address to receive a weekly newsletter from GIS Lounge:

Advertise on GIS Lounge

GIS Book Pick

The Look of Maps: An Examination of Cartographic Design is a cartographic classic by Arthur H. Robinson originally published in 1952. The book was based on Robinson’s doctoral research “which investigated the relationship between science and art in cartography and the resultant refinement of graphic techniques in mapmaking to present dynamic geographic information.”

  • Popular
  • Recent
  • Comments
  • Archives
  • What is GIS?
  • Creating Simple Maps with Microsoft Excel
  • GIS Job Listing Sites
  • GIS Distance Learning – Certificate and Degree Programs
  • GIS Career Resources – Jobs and Internships
  • Open and Machine Readable Now the Default for Government Data
  • Google Map Redesign
  • Crowdsource Power Plant Data Project
  • Shapefile Viewers
  • Timelapse Satellite Imagery – View Changes on Earth over Time
  • Mark: A very easy way to do this!!! Thank you.
  • Richard Ortwine: I am currenlty working on a project that will show there are more liquor stores in zip codes that ha
  • John Chioles: This is a phenomenal move on the part of the USGS! I remeber getting imagery was cost prohibitive, n
  • aizolnai: this is yesterday's news, but it's so well illustrated that it's defo worth a (re)read, thx for the
  • Web GIS System: FYI. We have collected 1,545 responses in our 2012 GIS salary survey to our vendors and customers pa

Connect


Introduction to GIS

New to GIS? Start by reading What is GIS for an introduction to Geographic Information Systems. Next visit the GIS 101 launch page for basics of GIS articles.

Getting Started with GIS

To understand the different options for GIS education read How to Learn GIS , GIS distance learning programs, and GIS certification versus certificate programs

GIS Jobs

Interested in GIS as a career? Visit GISGig.com for GIS job listings.A good first article is the Building a Career in GIS which provides an introduction to the building blocks of GIS employment .

Subscribe

Enter your email address below to receive updates each time we publish new content.

Connect

Connect with us on the following social media platforms.

Subscribe via RSS Feed Connect on Facebook Follow Me on Twitter Connect on Google Plus Join Our LinkedIn Group

GIS Resources

  • What is GIS?
  • GIS 101
  • GIS Career
  • Cartography
  • Maps
  • GIS Software
  • Learn GIS
  • Data
  • Free GIS

Colophon

  • Advertising on GIS Lounge
  • Submitting to GIS Lounge
  • Contact GIS Lounge
  • Subscribe
  • Site Map
© 2013 GIS Lounge. All rights reserved.