Spatial data as matrices and rasters
Content for Wednesday, September 21, 2022
Readings
Today we’ll be exploring the raster data model and how it is implemented within the spatial packages in the R computing environment. These chapters are not ‘prerequisite’ reading for the week, but provide a lot of helpful background for raster proccessing in R.
The
rasterpackage vignette has a number of helpful examples for different workflows with raster objects inR.The
terrapackage vignette describes the new raster functions available interra, their relationship to those in therasterpackage, and the changes in syntax between the two.The Functional Programming and Measuring performance from Advanced R (Wickham 2019) provide an excellent introduction to developing your own functions for repeated operations and ways to optimise code for large problems. Raster data processing often involves repeating (sometimes multiple) steps 100s of times. These chapters introduce strategies for developing functions for repeated operations and identfying and fixing bottlenecks in those functions.
Objectives
By the end of today, you should be able to:
Describe the raster data model and its representation in R
Access the elements that define a raster
Build rasters from scratch using matrix operations and
terra
Slides
The slides for today’s lesson are available online as an HTML file. Use the buttons below to open the slides either as an interactive website or as a static PDF (for printing or storing for later). You can also click in the slides below and navigate through them with your left and right arrow keys.
View all slides in new window Download PDF of all slides