Chris Holden (ceholden@gmail.com) - https://github.com/ceholden

Introduction

Tutorial of basic remote sensing and GIS methodologies using open source software (GDAL in Python)

Why Python?

  • Easy to learn

    • Python is an interpreted, dynamically typed language with little boilerplate code required to begin doing useful things
    • Test out your code in Python's interpreter (read-evaluate-print loop) before you put your code into a script
    • Very readible and closer to human thoughts than C/Java/R/MATLAB
  • Python is an actual programming language with a large standard library

    • tools for file manipulation, command line argument parsing, and web access and parsing already exist and are robust
    • Python already widely used in other scientific communities and outside of science for web servers, desktop applications, and server management
  • Scientific Python provides very well documented and easy to use interfaces to pre-existing numeric methods

    • Linear alebgra, classification routines, regression methods, and more have been published for decades as Fortran or C codes
    • Libraries such as SciPy, NumPy, and SciKits wrap and extend these pre-existing codes in an easy to use package
    • Python provides numerous tools to introspect objects and Python code conventions make access of documentation easy (e.g., type ?np.random.randint to access the documentation string (docstring) of NumPy random number generator
  • Large community with innumerable examples on blogs, StackOverflow, Github, etc.

  • Develop Python plugins for QGIS

  • Script analyses in QGIS or ArcMap

  • Many GDAL tools written in Python

    • useful for example code and a strong recommendation
  • Free

Other resources

There are many resources for doing remote sensing and GIS with Python on the web, but here are some of the better ones:

Note on Python 2 vs Python 3

This tutorial will try to target either Python 2.7 or Python 3.4 and 3.5. To ensure you're using a compatible version of Python, you can run the following:

python --version

at the command line.

Python 3 has many great new features (more informative stack traces, better unicode handling, asyncio, matrix algebra notation using @, and more) and is the future of the language. Unfortunately, some scientific packages (QGIS, for example) have not yet completed the transition away from Python 2. Unless you have good reason to use Python 2 (like if you're writing a QGIS plugin in Python), the general concensus is to recommend using Python 3.