Skip to content

Instantly share code, notes, and snippets.

@jwilson8767
Last active October 1, 2019 16:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwilson8767/ddf03d8ac44c5c8ae831da304901a55a to your computer and use it in GitHub Desktop.
Save jwilson8767/ddf03d8ac44c5c8ae831da304901a55a to your computer and use it in GitHub Desktop.
Python and GIS resources

Python and GIS Resources

This is an entrypoint into the world of GIS using Python. It's not everything you'll need to know, but it should help you get oriented and serve as a reference in the future.

A couple tools I recommend you setup right from the start are Conda:

  1. The Conda package manager is a quick way to get a working python environment and add bells and whistles as needed.
  2. Once you have conda, run conda install -c conda-forge jupyter pandas geopandas using your Conda Prompt to get a bunch of the packages I expect you'll need right from the start. The -c conda-forge specifies that conda should try to lookup things in the "Conda Forge" package repository, which is how many of the open source python GIS tools are distributed. Jupyter is an interactive python programming tool that makes it easy to experiment and make mistakes. Pandas and GeoPandas are covered more below.
  3. Now that you have Jupyter, you can run jupyter notebook in your Conda Prompt to get a web interface for python programming!

For the absolute beginner (feel free to skim and use as reference later):

Pandas

Pandas is a library for tabular data manipulation. As a data scientist Pandas is the most important library you can learn. You can do simple things like read and write files, perform aggregations / reshape data, and even do complex analytical tasks like "groupby" and "join" (which Pandas calls df.merge)

Here's a detailed book, but I recommend you also use Youtube to see examples of things you can do with Pandas and how to approach problems.

GIS in python

Check out this amazing course material for GIS in python, it's a great overview of what you can do with in-depth examples.

GeoPandas (for vector GIS data)

Just like Pandas is used for tabular data analysis in Python, GeoPandas is used for analysis of vector GIS data (and associated attributes). It lets you do super powerful analyses like spatial joins, dissolves, and groupby, all built on the power and performance of Pandas. This course provides a great introduction to core GeoPandas functionality (with videos!)

Rasterio (for raster GIS data)

Rasterio is very different from pandas/geopandas in that it thinks about pixels and bands and does math very fast. Here's a quick intro.

When do you know enough?

The amount of information here can be daunting, but you don't have to memorize or even fully understand all of it. Bookmark this page and come back to it. As you find useful tidbits elsewhere, bookmark them. When you someday need to do zonal statistics on 15GB of raster data using a layer of 15,000 polygons, a quick dig through these resources should set you off in the right direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment