1 Overview

This is a minimal introduction to GIS and handling spatial data in R compiled for the Biological Sciences BSc(Honours) class at the University of Cape Town.

1.1 General

The goal is to give you a very brief introduction to Geographic Information Systems (GIS) in general and some familiarity with handling spatial data in R. GIS is a field of research that many people dedicate their entire lives to, yet we only have a week, so this really is a minimalist introduction. I’ll focus on giving you a broad overview and some idea of how to teach yourself (using R).

The core outcomes I hope you’ll come away with:

  • Some familiarity with GIS and what it can help you achieve
  • Some familiarity with GIS jargon and technical terms
  • Highlight some of the common problems and pitfalls when using GIS
  • Some familiarity with handling spatial data in R
  • Some hints and resources to help you teach yourself R
  • Some idea of how to help yourself or find help when you inevitably come unstuck…

These course notes borrow or paraphrase extensively from Adam Wilson’s GEO 511 Spatial Data Science course, Manny Gimond’s Intro to GIS & Spatial Analysis and the 2020 series of GIS Lecture Lunches by Thomas Slingsby and Nicholas Lindenberg from UCT Library’s GIS Support Unit.

Other very valuable resources include:

All code, images, etc can be found here. I have only used images etc that were made available online under a non-restrictive license (Creative Commons, etc) and have attributed my sources. Content without attribution is my own and shared under the license below. If there is any content you find concerning with regard to licensing, or that you find offensive, please contact me. Any feedback, positive or negative, is welcome!

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

1.2 Using this resource

I’ve included quite a bit of demonstration R code in Chapters 7 and 8. To run the code you will need:

  • to have working R and RStudio installations - this tutorial may help if needed
  • to install the following R packages (you can copy and run the code):
    • required: install.packages(c("tidyverse", "sp", "raster", "sf", "lwgeom", "terra", "stars", "exactextractr"))
    • optional, but handy for some visualizations: install.packages(c("cowplot", "hrbrthemes", "knitr", "leaflet", "htmltools", "rosm", "ggspatial", "rnaturalearth", "mapview", "tmap"))
  • to download the datasets discussed in section 7.1

1.3 Module and Project details


Lectures will be held in the mornings between 10:00 to 12:00 Monday to Thursday in BIOLT1.

  • For the Honours students, Thursday afternoon, 2-4PM, will be lightning talk presentation day (venue TBD).
  • For the Conservation Biology MSc course, we’ll do lightning talk presentations on Friday at 10AM.


Afternoons are self-study time where you will incrementally develop your own individual GIS project in R and RMarkdown or Quarto.

  • For the Honours students, the project will count 70% of your mark for the module and will be due on Friday the 1st March. You will need to submit a .Rmd or .Qmd file and stitched HTML notebook. You’re welcome to do this in a Git Repository (nudge nudge), now that we’ve completed the Reproducible Research module.
  • For the Conservation Biology students, the project will count 50% (10% lightning talk, 40% project). You will need to submit a .Rmd or .Qmd file and stitched HTML notebook, but I don’t expect you to use GitHub.

The focus of the assignment is essentially setting up a GIS workflow and will be assessed on whether you’ve absorbed the content of the lectures.

  • For the Honours students, the topic and datasets used will be up to you.

Pro tip: Use this as an opportunity to get a kick start on your Honours projects. If your Honours project doesn’t require GIS (which is unlikely) then either help a buddy or let your curiosity roam wild! This is a teaching exercise, so it doesn’t even have to be based on biological data, but it would help you to explore some of the data sources suggested below.

  • For the Conservation Biology students, the project needs to be based on one of the themes that we are reading about for week two. See separate email and Amathuba announcement.

The project objectives, broken down as daily goals to help you pace yourselves this week:

  • Day 1:
    • Define a question that requires GIS, the kinds of data you’ll need to address the question, and describe in words what you think you would need to do with the data to get there.
    • Find and describe the datasets you’ll need for your analysis (type, source, how created, etc).
  • Day 2:
    • Describe the GIS workflow you think you’ll need to perform your analysis (in words and/or a figure). Reconsider and refine your datasets.
  • Day 3:
    • Translate your workflow into the R functions you think you’ll need to use and begin coding and running the GIS workflow in R.
  • Day 4:
    • Keep working on the code.
    • Develop and present your 1 slide lightning talk - examples from the Honours class of 2021 are here and 2022 are here.
  • Until the 1st March (Hons students): Iterate over the previous steps until done!

I will be available 2-3PM on Wednesday afternoon and 11AM-12PM on Friday morning as a “help desk” to assist you refine your projects and troubleshoot issues.

Lightning talks: you’ll do lightning presentations (30% of your mark for the module) on your GIS projects (1 slide, 2 minutes presentation, 1 minute questions). Don’t worry, you won’t lose marks if your projects are not yet complete! We just want to know what you’re doing your project on, what datasets you’re using, and what you plan to do with them. Please read the instructions in the Google slide deck and add your slide.

  • For the Honours students, this will be on Thursday afternoon (2PM, 22nd February).
  • For the Conservation Biology students, this will be at 10AM on Friday (23rd February) online.

Some sources of local data to help you get started. Feel free to look for others! If you find good ones, let me know and I’ll add them.

Make sure to check the data use policies and make sure you have permission use the datasets!!!