GOG
530 Special Topics: Python and ArcGIS
What this course is about
Learning the basics of the Python programming language
Learning how ArcGIS uses Python as a scripting language
Learning aspects of collaborative programming with Git
What we will be doing
Writing lots of little �standalone� Python programs to try out language
features
Writing many Python scripts to automate ArcGIS tasks
Working together in groups to create a final project
A note on Python versions
We will be using Python 2.7 (the latest of what is often referred to as
the �legacy� version)
This is the version used by ArcGIS 10.x and is also widely used in the
general computing world
Python 3.x is gaining popularity but is not backwards-compatible with
2.7
It will not work with ArcGIS 10.x
Don�t worry about Python 3.x for now�here is a link that
summarizes the differences
Our tools
Anaconda
Python and Idle
A simple but complete development environment (IDE) for beginners
I will mention other environments as we go
Currently the predominant GIS for government, education, and consulting
New open source options are emerging but do not yet have the same market
share
Not to worry�the general scripting skills you learn here will be
applicable to other environments
We will be using version 10.4
A note regarding GIS and programming environments
These change constantly
Always expect to learn new analytical skills as the need arises
Learn �how to learn� new scripting and programming languages
If this is your first language, the next will be much easier!
What does �scripting� mean for us?
For us, a script is a program meant to work within the context of a
larger package (like ArcGIS)
e.g. we click a button in ArcToolbox to run a script which does something useful
ArcGIS (and its predecessors, ArcInfo and
ArcView) have used, and abandoned, a number of scripting languages in the past:
Still supported by ESRI
Avenue (used with PC ArcView in Windows 3.x series)
Much liked by GIS developers
Visual Basic
Alternatives to scripting�using one
of the ArcGIS APIs
An application programming interface is a library of programming modules
A developer writes a program in some language (Java, C#, C++, etc.) that �calls� functionality �exposed� by the API
e.g., your ride-hailing application written in Java uses the ArcGIS API to handle mapping
Unlike scripting, your own application calls ArcGIS functionality
An API library with supporting tools is often referred to as a software development kit (SDK)
We will not be using the ArcGIS APIs in this class but you may wish to explore them on your own
Here is a summary of the ArcGIS SDKs
If your code redistributes an ArcGIS API then you must
license it from ESRI
More alternatives�open source GIS
Later in the course we will look at how you can work with and contribute
to programs and APIs like QGIS, GRASS, GDAL, and others
The Python programming language
You can find a reasonable
history of Python here
Some important information from this link:
Python was created in the late 1980s by Guido van Rossum
The name is a nod to Monty Python (not the snake)
The language is �multi-paradigm;� it supports both
���� Structured programming
techniques (common to C and many older languages
���� Object-oriented programming
techniques (common to Java, C#, C++, and many new languages)
What is Python used for?
Solving general programming problems in science, engineering, education,
and business
Why do people like Python?
The language syntax appears informal compared to other languages like
Java, etc.
This is very handy for experienced programmers
DANGER!!
You still need to know how Python works�confusing things happen if you
don�t
What are some alternates to Python?
The following languages are popular for general development tasks (not
just GIS)
Focuses on statistics but useful for other tasks relying on linear
algebra�many similarities to Python
Very good object-oriented programing language
Very similar to Java�good links to Microsoft�s .NET framework
Often the preferred language for developers working with multiple
APIs�easier to use in the long run
ArcGIS
Remember, ArcGIS is a commercial product with its own jargon universe
ArcGIS is the general name for a huge suite of both loosely and tightly coupled
software products
Many ArcGIS features do not have their own �pushbutton� interfaces (as a
tool in some toolbox, e.g.)
These features are only accessible through the kinds of �scripts� that
we will write
Do not get attached to anything in ArcGIS! It WILL change!
For now, Python is your best scripting tool in ArcGIS
Should I learn more programming languages? Which
ones??
Yes�look at listings on the GIS job posting sites and try picking up the
languages they�re looking for
The first language is the hardest�it gets easier with each new one
You can learn these from books, friends, web tutorials, etc.
Much easier than learning Italian!