This lesson is being piloted (Beta version)

Introduction to Geospatial Raster and Vector Data with R

Lesson Authors: Leah A. Wasser, Megan A. Jones, Zack Brym, Kristina Riemer, Jason Williams, Jeff Hollister, Mike Smorul, Joseph Stachelek

Lesson Maintainers: Leah Wasser, Joseph Stachelek, Tyson Swetnam, Lauren O’Brien, Janani Selvaraj, Lachlan Deer, Chris Prener, Juan Fung

The episodes in this lesson cover how to open, work with and plot vector and raster-format spatial data in R. Additional topics include working with spatial metadata (extent and coordinate reference systems), reprojecting spatial data, and working with raster time series data.

Prerequisites

Data Carpentry’s teaching is hands-on, so participants are encouraged to use their own computers to ensure the proper setup of tools for an efficient workflow. To most effectively use these materials, please make sure to download the data and install everything before working through this lesson.

R Skill Level

This lesson assumes you have some knowledge of R. If you’ve never used R before, or need a refresher, start with our Introduction to R for Geospatial Data lesson.

Geospatial Skill Level

This lesson assumes you have some knowledge of geospatial data types and common file formats. If you have never worked with geospatial data before, or need a refresher, start with our Geospatial Project Organization and Management lesson.

Install Software and Download Data

For installation instructions and to download the data used in this lesson, see the workshop homepage.

Setup RStudio Project

Make sure you have set up a RStudio project for this lesson, as described in the setup instructions and that your working directory is correctly set.

Schedule

Setup Download files required for the lesson
00:00 1. Intro to Raster Data in R What is a raster dataset?
How do I work with and plot raster data in R?
How can I handle missing or bad data values for a raster?
00:30 2. Plot Raster Data in R How can I create categorized or customized maps of raster data?
How can I customize the color scheme of a raster image?
How can I layer raster data in a single image?
01:00 3. Reproject Raster Data in R How do I work with raster data sets that are in different projections?
01:30 4. Raster Calculations in R How do I subtract one raster from another and extract pixel values for defined locations?
02:00 5. Work With Multi-Band Rasters in R How can I visualize individual and multiple bands in a raster object?
02:30 6. Open and Plot Shapefiles in R How can I distinguish between and visualize point, line and polygon vector data?
03:00 7. Explore and Plot by Shapefile Attributes How can I compute on the attributes of a spatial object?
03:30 8. Plot Multiple Shapefiles in R How can I create map compositions with custom legends using ggplot?
How can I plot raster and vector data together?
04:00 9. Handling Spatial Projection & CRS in R What do I do when vector data don’t line up?
04:30 10. Convert from .csv to a Shapefile in R How can I import CSV files as shapefiles in R?
05:00 11. Manipulate Raster Data in R How can I crop raster objects to vector objects, and extract the summary of raster pixels?
05:30 12. Raster Time Series Data in R How can I view and and plot data for different times of the year?
06:00 13. Create Publication-quality Graphics How can I create a publication-quality graphic and customize plot parameters?
06:30 14. Derive Values from Raster Time Series How can I calculate, extract, and export summarized raster pixel data?
07:00 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.