Introduction to GIS in R: Summary and Set-up
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.
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 lesson.
Download Data
The data and lessons in this workshop were originally developed through a hackathon funded by the National Ecological Observatory Network (NEON) - an NSF funded observatory in Boulder, Colorado - in collaboration with Data Carpentry, SESYNC, and CYVERSE. NEON has been collecting data for 30 years to help scientists understand how aquatic and terrestrial ecosystems change. The data used in these lessons cover two NEON field sites:
- Harvard Forest (HARV) - Massachusetts, USA - fieldsite description
- San Joaquin Experimental Range (SJER) - California, USA - fieldsite description
There are four data sets included, all of which are available on
Figshare under a CC-BY license. You can download all the data used
in this workshop by clicking this
download link. Clicking the download link will download all of the
files as a single compressed (.zip
) file. To expand this
file, double-click the folder icon in your file navigator application
(for Macs, this is the Finder application).
These data files represent the teaching version of the data, with sufficient complexity to teach many aspects of data analysis and management, but with many complexities removed, students can focus on the core ideas and skills being taught.
Dataset | File name | Description |
---|---|---|
Site layout shapefiles | NEON-DS-Site-Layout-Files.zip | A set of shapefiles for the NEON’s Harvard Forest field site and US and (some) state boundary layers. |
Meteorological data | NEON-DS-Met-Time-Series.zip | Precipitation, temperature and other variables collected from a flux tower at the NEON Harvard Forest site |
Airborne remote sensing data | NEON-DS-Airborne-RemoteSensing.zip | LiDAR data collected by the NEON Airborne Observation Platform (AOP) and processed at NEON including a canopy height model, digital elevation model and digital surface model for NEON’s Harvard Forest and San Joaquin Experimental Range field sites. |
Landstat 7 NDVI raster data | NEON-DS-Landsat-NDVI.zip | 2011 NDVI data product derived from Landsat 7 and processed by USGS cropped to NEON’s Harvard Forest and San Joaquin Experimental Range field sites |
Contributors
This lesson was inspired by Software and Data Carpentry Workshops.
Acknowledgments
CDC, NCDC, DTRA, VT
Setup Instructions | Download files required for the lesson | |
Duration: 00h 00m | 1. Intro to Raster Data |
What is a raster dataset? How do I work with and plot raster data in R? |
Duration: 00h 50m | 2. Intro to Raster Data (Advance) |
What is a raster dataset? How can I handle missing or bad data values for a raster? |
Duration: 01h 40m | 3. Plot Raster Data |
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? |
Duration: 02h 50m | 4. Reproject Raster Data | How do I work with raster data sets that are in different projections? |
Duration: 03h 50m | 5. Raster Calculations (Advance) | How do I subtract one raster from another and extract pixel values for defined locations? |
Duration: 04h 50m | 6. Work with Multi-Band Rasters (Advance) | How can I visualize individual and multiple bands in a raster object? |
Duration: 05h 50m | 7. Open and Plot Vector Layers | How can I distinguish between and visualize point, line and polygon vector data? |
Duration: 06h 20m | 8. Open and Plot Vector Layers (Advance) | How can I compute on the attributes of a spatial object? |
Duration: 07h 20m | 9. Plot Multiple Vector Layers (Advance) |
How can I create map compositions with custom legends using
ggplot? How can I plot raster and vector data together? |
Duration: 08h 20m | 10. Handling Spatial Projection & CRS | What do I do when vector data don’t line up? |
Duration: 09h 20m | 11. Convert from .csv to a Vector Layer | How can I import CSV files as vector layers in R? |
Duration: 10h 20m | 12. Manipulate Raster Data |
How can I crop raster objects to vector objects, and extract the summary
of raster pixels? |
Duration: 11h 20m | 13. Raster Time Series Data (Advance) | How can I view and and plot data for different times of the year? |
Duration: 12h 20m | 14. Create Publication-quality Graphics (Advance) | How can I create a publication-quality graphic and customize plot parameters? |
Duration: 13h 20m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
This lesson is designed to be taught in conjunction with other lessons in the DTRA Workshop R and DTRA Workshop ENM.