Digital Geography

Python for Geospatial Data Analysis (Part II)

Reading Geospatial Files In the last post in this thread I provided a bit of background and some simple instructions for installing python and the necessary modules for geospatial analysis. In this post I will cover some basic python syntax and reading raster data from a geospatial file. Let’s get started. Python files typically end in the extension .py. In a OSX/Linux environment, the first line in your file should be the interpreter you want to use. On my macbook, my python executable is /opt/local/bin/python, so the first line of my file is After this, you need to load the…

Python for Geospatial Data Analysis (Part I)

For my first post on digital-geography.com I wanted to begin a discussion on a topic I have strong feelings about, Python. A common question I get from students and experienced colleagues is “What analysis environment do you use?”. Where I work most people use either IDL/Envi or Matlab for raster data analysis. These are good packages, with many advanced capabilities, but they can be restrictive. IDL or Matlab code can be difficult to move from system to system or share with others because both environments require licenses that can be quite expensive. That is particularly a problem if you are…