Learning the FOSS4g Stack: Python for Geospatial
4.4 (29 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
189 students enrolled

Learning the FOSS4g Stack: Python for Geospatial

leverage geospatial tasks with Python programming
4.4 (29 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
189 students enrolled
Created by Arthur Lembo
Last updated 4/2020
English [Auto]
Current price: $16.99 Original price: $24.99 Discount: 32% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 5.5 hours on-demand video
  • 8 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • You will learn how to write basic Python scripts.
  • You will also learn how to integrate Python packages that have GIS functionality.
  • As a bonus, this course will also show how to use Arcpy, and integrate ArcGIS with FOSS4g.
  • And you'll learn how to integrate SQL, PostGIS, and SpatiaLite.
  • Students should be comfortable with computers and GIS software
  • It would help if you've done a little programming, but even if you haven't we've got you covered. Students with Python experience can skip the introductory sections, and jump right to the spatial stuff.

If you are in the field of GIS, you're probably hearing everyone talking about Python, whether it's Arcpy in ArcGIS or special Python packages for doing things like geocoding.  In this course I am going to show you how to write Python code to perform spatial analysis.  The course isn't so much about learning Python, but rather how to integrate different spatial libraries within your Python code.  Using the course videos, you will work alongside of me to learn how I go about cobbling together Python code and various packages to solve spatial problems.  I'll provide you with all the data that I demonstrate in the course.

Of course, we'll have a brief overview of Python.  But after the brief refresher, we will dive into using Python with Open Source GIS and commercial GIS software.  Most courses only go over a single GIS program's use of Python.  But in this class, you'll get exposed to all kinds of different GIS software products, and learn how to tie them all together with Python.  

Who this course is for:
  • Students who want to expand their geospatial skills to include Python programming.
  • Students who want to learn how to integrate Python, QGIS, ArcGIS, Postgres, and cloud-based spatial data services togethe.r into a unified solution.
  • Students looking to nail that next interview that requires you to know something about GIS and scripting.
Course content
Expand all 31 lectures 05:16:35
+ Loading our software and data
5 lectures 27:48

In this section we are going to download QGIS 3.8.  If you get a newer version, even better. 

Preview 02:31
Installing Postgres 11

This lecture is going to give a brief overview of the data we'll be using for our course.  Make sure to download the python.zip file, and then unzip it in a folder: c:\training\python 

You'll have to restore the tompkins.backup file into Postgres if you wish to follow along with the coding.

Preview 05:48

There are lots of version of Python out there.  I'm using Python 3.7.  If you get 3.8 or newer, you'll be just fine. 

Installing Python 3

Now that the software is loaded, we want to add the Tompkins data set.  This lecture will show you how to restore the Tompkins.backup file into Postgres.

Loading data into Postgres
+ A gentle overview of Python
7 lectures 01:10:39

In this lecture, you'll get introduced to Python as a scripting language.  We won't be writing code just yet.  For now, I want to describe the many flavors of Python and get you familiar with the interface.  Also, I want to give us all a wake up call regarding some of the complexities when working with many different versions of Python. 

The general overview

Get ready.  We're going to start writing python code - in this lecture, we'll stick to strings.  The best thing you can do is follow along with the video, and then replicate the code.  By typing it in yourself (rather than copy/pasting from a master copy), you are more likely to really pick up on the language. 

The Python language: strings

So much of what we do with python programming is reading and writing data.  In this lecture, we'll read data from a CSV file, and start processing the data.  We'll also learn how to write the output into another file. 

Reading and writing from files

In this lecture, we continue our gentle tour of python, and will start introducing examples of numeric data types and functions, and also functions that work with lists.

The Python Language: numbers and lists

What makes scripting so powerful is how we can control the flow of the program and the user experience.  In this lecture, we'll learn about important concepts like loops and conditional statements.

Statements and control

We are going to write a very simple script to convert temperatures.  This seems almost juvenile.  But, even a simple program for temperature conversion requires us to interact with the user, introduce if/then statements, and also performing calculations.  So, its a great jumping off point for the rest of our programming. 

A simple program to convert temperature

Python has lots of built in functions that allow us to perform mathematical, web based, and file I/O.  These modules come with python, and learning to use them will help you more from basic scripting to more intermediate complexity as you solve problems. 

Default Python modules
+ External modules: the magic of PIP
6 lectures 59:45

With python, and sqlite package, you can write a python script that will communicate directly with SQLite.  That's pretty powerful stuff!

Preview 09:30

if you thought connecting to SQLite with python was impressive, wait til you see what comes next: adding spatial capabilities to SQLite with Spatialite.  And, we can write a python script to not only perform impressive spatial analysis with SQLite, but we can also start interacting with the user. 

Blow your mind with SQLITE: spatial!

While python has math capabilities, it doesn't come close to the capabilities of using numpy.  Numpy is one of the most widely used and respected libraries of scientists who program using python. 


Our last lecture introduced some interesting capabilities that numpy performs.  For this lecture, we are going to tackle a very sophisticated mathematical concept: linear algebra.  Don't panic, we aren't going to go deep.  But, you'll see just how easy it is to perform matrix algebra for least squares adjustment - something we do a lot of in geospatial analysis.

Linear Algebra with Numpy (also how to create a function)

This is probably what you've been waiting for: connecting to Postgres with python.  And, not only are we going to connect to Postgres, we are going to start issuing PostGIS spatial commands to perform geospatial analysis.  If you can do this, you are going to get noticed for your superior skills!

Preview 08:33

Not only can you connect to different libraries with python, but you can even connect to Microsoft Excel.  And, if you can connect to Excel, you can integrate Excel functions with Postgres functions, with geospatial functions.  It's going to start sounding redundant, but if you can do this, you'll really be seen as an expert in python.

Access Microsoft Excel with Python
+ Section 6: Python with Desktop QGIS (ArcGIS and QGIS)
4 lectures 01:06:17
A quick intro to Arcpy
Extending Arcpy to run outside of ArcGIS
A quick intro to Qpy
Extending our use of Qpy
+ Applying what we learned in Qpy
3 lectures 25:45
Lab Question 1: How many TRI sites are within .5 miles of the interstate
Lab Question 2: How many schools are within .5 miles of Lindau Chemical
Lab Question 3: What % of white / non white are vulnerable to a TRI spi
+ Creating forms with Python
4 lectures 45:38

In this lecture, you will learn how to import the formlayout package and start shaping the structure of a GUI with python.  This is not a sophisticated for editor, but it is really easy to use, and very likely can handle 80% of what we need in the form of a GUI. 

Creating forms using formlayout

In this lecture you'll see how we extend the simple form we previously created to integrate ArcGIS with Arcpy and formlayout.  In this case, you can start creating forms for ArcGIS applications, without the need to use ArcScripts. 

Integrating forms with ArcGIS

Now we are going to expand our use of forms to Postgres!  In this lecture, you'll learn how to create interactive forms with the user, and connect those forms with Postgres, allowing you to issue SQL and spatial SQL however you feel.  You'll also notice that the codes is short, light weight, but very interactive.  This will prove that you can create a Postgres/PostGIS form in a matter of minutes.

Integrating forms with Postgres and PostGIS
Bonus Lecture: How to keep learning