Working with spatial data

Working with raster and vector spatial data in R (with terra and sf) and in QGIS.

Spatial data in R

Spatial Data in R (MAP) Part of Introduction to Spatial Analysis for Infectious Diseases → Beginner

Robert Hijmans and others

The terra package is the most powerful modern method to work with raster data in R (and replaces the deprecated raster package), and can also be used with vector* data. This is a step-through guide to working with spatial data using terra. For a broader introduction to spatial data in R, this page forms just one section of rspatial.org, which has a wider range of resources that may be helpful for beginners in spatial data science.

*Where we indicate vector* with a * we mean vector as a spatial data form, i.e., points, lines, polygons, not vector as in disease vector like a mosquito.

Simple Features for R

Intermediate

Edzer Pebesma

The sf or Simple Features package is another powerful modern tool for working with vector* data in R. This guide explains what simple features are and the fundamentals of how the package works, but also links to a series of increasingly detailed articles on the use of sf, as well as the package reference manual.

Spatial data in QGIS

Spatial Data in QGIS (MAP) Part of Introduction to Spatial Analysis for Infectious Diseases → Beginner

QGIS is a free, open-source, and well supported Geographic Information System in which users can manipulate and analyse spatial vector* and raster data. This Getting Started article steps the user through installation and basic loading of data. It forms Chapter 5 of the full QGIS User Guide.

While analysis of spatial data in R is generally our recommendation because it is easily repeatable and modifiable, this does need the overhead of skill development to use R effectively, which may not always be practical for all users. QGIS is an excellent tool for quick plotting and exploration of spatial data and will suit many user needs.