Skip to content

Geospatial Python Analytics – February 26th 2020


These are the joining instructions for the Geospatial Python Analytics – February 26th 2020 at HR Wallingford. For any further information on joining instructions please email Andrew


To really get the value from this day course it would be good to have

a) had 1-2 years experience with Python. and

b) some experience with Geospatial Python

If you cannot write for loops, understand data types, conditional statements etc then this course will not be suitable for you.

I understand and appreciate that everyone has their own unique computer setup. This is something that can cause Python users some problems. It can be confusing.

Because of this I recommend you install Anaconda. However you can use your own setup if you prefer.

Recommended Python Set up (Windows)

Important please check before course starts

I recommend using Anaconda This course is for Python 3

You may need to open the Anaonda Prompt as an Administrator, by doing this it should remove any permission errors. Right click and select Run As Administrator.

If you can type ‘python’ into a the anaconda prompt then you should be good to go

type exit() to leave the Python environment and return to the command prompt. It will look like

(base) your directory (eg C:/users/…)

To install gdal (the most critical step).

conda install -c conda-forge gdal

It may take a while eventually you will get a prompt asking whether you wish to install, select Y (for yes) and press enter.

Please also install the following packages

opencv install

conda install -c conda-forge opencv=3.3.1

Depending on your Python version you may need to install opencv=4.2.0

We will not be relying the following libraries but I recommend installing them as default and they are useful, and may aid your learning.

sklearn install

conda install -c anaconda scikit-learn

skimage install

conda install -c anaconda scikit-image

raster stats install

conda install -c conda-forge rasterstats

scipy install

conda install -c anaconda scipy

rasterio install

conda install -c anaconda rasterio

GeoPandas install

conda install -c conda-forge geopandas

Shapely install (we will not be using this on this course, but it is well worth installing)

conda install -c conda-forge shapely

Open an anaconda prompt and check that gdal is installed




from osgeo import gdal,ogr

(shown below)

type exit() to leave the Python environment

Anaconda comes pre cooked with jupyter notebook

type (you might wish to change directory, for example, to the root of  D: first – cd d:)

jupter notebook

into the command prompt and it should open up a web browser within your directory of all your folder/files and notebooks.

I have written two detailed blog posts that should be of help if you have any issues

Python for Geospatial work flows part 1: Use anaconda


Python for Geospatial work flows part 2: Use Jupyter Notebooks

I will cover Jupyter Notebooks in this course, so you don’t need to read this post.

Further useful software

  1. Notepad ++
  2. OSGeo4W for QGIS

A note on Mac installation.

I run this course on a Windows 10 machine. If you need to install gdal on a Mac then I have been told that the following commands work:


conda install -c conda-forge/label/cf201901 gdal

I think that ensures gdal is correctly installed.


gdalinfo –version

To check I had gdal on the system


conda install krb5

Apparently this is a dependency of gdal but isn’t installed by default.

I don’t have access to a Mac so please let me know if this doesn’t work (I am not sure what will work if it doesn’t)

Please attempt to install gdal prior to attending the course, it is not fair on the other attendees if you don’t have a working installation and we have to spend time getting you setup.


I run the course through a folder on my computer. I suggest you create a folder on your machine


Please download the course data (60mb) data_package_analytics

Extract this to



I will make the course code available at the start of the afternoon. I would like you to try and follow the examples as we go, but don’t worry about mistakes this is all good practice.


Throughout the course as our learning progresses I have created a couple of challenges. These are to aid your learning, help you practice. The aim is to experiment try new things.


We will cover

  • Loading and plotting images
  • Colour Transforms and thresholding
  • Interactive opencv
  • Example of counting objects

We will start at 1:30pm and finish at 4:30pm

Please contact me with any questions