# Spatial Data and GIS Lessons

## Use R, Python and Other Open Tools For GIS

Most scientific data are geographically located and thus have a spatial component. GIS skills are thus important for working with scientific data. R and Python are free and open scientific programming languages that you can use to work with GIS data and do tasks that you may already do with tools like ArcGIS or QGIS.

In the lessons below, learn how to open, manipulate and plot spatial data in the R programming language. Also learn to use tools like Leaflet and ggplot to create custom and interactive maps. Finally learn how to use remote sensing data like Landsat, NAIP and MODIS in R. Come back later this spring for lessons in Python!

## Maps in R: R Maps Tutorial Using Ggplot

You can use R as a GIS. Learn how to create a map in R using ggplot in this R maps tutorial.

last updated: 10 Jan 2018

## Work with MODIS Remote Sensing Data in R.

In this lesson you will explore how to import and work with MODIS remote sensing data in raster geotiff format in R. You will cover importing many files using regular expressions and cleaning raster stack layer names for nice plotting.

last updated: 10 Jan 2018

## Calculate and Plot Difference Normalized Burn Ratio (dNBR) from Landsat Remote Sensing Data in R

In this lesson you review how to calculate difference normalized burn ratio using pre and post fire NBR rasters in R. You finally will classify the dNBR raster.

last updated: 10 Jan 2018

## Work with the Difference Normalized Burn Index - Using Spectral Remote Sensing to Understand the Impacts of Fire on the Landscape

In this lesson you review the normalized burn ratio (NBR) index which can be used to identify the area and severity of a fire. Specifically you will calculate NBR using Landsat 8 spectral remote sensing data in raster, .tif format.

last updated: 10 Jan 2018

## How to Replace Raster Cell Values with Values from A Different Raster Data Set in R

Often data have missing or bad data values that you need to replace. Learn how to replace missing or bad data values in a raster, with values from another raster in the same pixel location using the cover function in R.

last updated: 10 Jan 2018

## Get Landsat Remote Sensing Data From the Earth Explorer Website

In this lesson you will review how to find and download Landsat imagery from the USGS Earth Explorere website.

last updated: 10 Jan 2018

## Clean Remote Sensing Data in R - Clouds, Shadows & Cloud Masks

In this lesson, you will learn how to deal with clouds when working with spectral remote sensing data. You will learn how to mask clouds from landsat and MODIS remote sensing data in R using the mask() function. You will also discuss issues associated with cloud cover - particular as they relate to a research topic.

last updated: 10 Jan 2018

## Adjust plot extent in R.

In this lesson you will review how to adjust the extent of a spatial plot in R using the ext() or extent argument and the extent of another layer.

last updated: 10 Jan 2018

## Plot Grid of Spatial Plots in R.

In this lesson you learn to use the par() or parameter settings in R to plot several raster RGB plots in R in a grid.

last updated: 10 Jan 2018

## How to Remove Borders and Add Legends to Spatial Plots in R.

In this lesson you review how to remove those pesky borders from a raster plot using base plot in R. We also cover adding legends to your plot outside of the plot extent.

last updated: 10 Jan 2018

## Landsat Remote Sensing tif Files in R

In this lesson you will cover the basics of using Landsat 7 and 8 in R. You will learn how to import Landsat data stored in .tif format - where each .tif file represents a single band rather than a stack of bands. Finally you will plot the data using various 3 band combinations including RGB and color-infrared.

last updated: 10 Jan 2018

## The Fastest Way to Process Rasters in R

.

last updated: 08 Dec 2017

## Calculate NDVI in R: Remote Sensing Vegetation Index

NDVI is calculated using near infrared and red wavelengths or types of light and is used to measure vegetation greenness or health. Learn how to calculate remote sensing NDVI using multispectral imagery in R.

last updated: 08 Dec 2017

## How Multispectral Imagery is Drawn on Computers - Additive Color Models

In this lesson you will learn the basics of using Landsat 7 and 8 in R. You will learn how to import Landsat data stored in .tif format - where each .tif file represents a single band rather than a stack of bands. Finally you will plot the data using various 3 band combinations including RGB and color-infrared.

last updated: 08 Dec 2017

## How to Open and Work with NAIP Multispectral Imagery in R

In this lesson you learn how to open up a multi-band raster layer or image stored in .tiff format in R. You are introduced to the stack() function in R which can be used to import more than one band into a stack object in R. You also review using plotRGB to plot a multi-band image using RGB, color-infrared to other band combinations.

last updated: 08 Dec 2017

## Import and Summarize Tree Height Data and Compare it to Lidar Derived Height in R

It is important to compare differences between tree height measurements made by humans on the ground to those estimated using lidar remote sensing data. Learn how to perform this analysis and calculate error or uncertainty in R.

last updated: 10 Jan 2018

## Extract Raster Values Using Vector Boundaries in R

This lesson reviews how to extract pixels from a raster dataset using a vector boundary. You can use the extracted pixels to calculate mean and max tree height for a study area (in this case a field site where tree heights were measured on the ground. Finally you will compare tree heights derived from lidar data compared to tree height measured by humans on the ground.

last updated: 10 Jan 2018

## GIS in R: Plot Spatial Data and Create Custom Legends in R

In this lesson you break down the steps required to create a custom legend for spatial data in R. You learn about creating unique symbols per category, customizing colors and placing your legend outside of the plot using the xpd argument combined with x,y placement and margin settings.

last updated: 10 Jan 2018

## GIS in R: How to Reproject Vector Data in Different Coordinate Reference Systems (crs) in R

In this lesson you learn how to reproject a vector dataset using the spTransform() function in R.

last updated: 10 Jan 2018

## GIS in R: Understand EPSG, WKT and other CRS definition styles

This lesson discusses ways that coordinate reference system data are stored including proj4, well known text (wkt) and EPSG codes.

last updated: 10 Jan 2018

## GIS With R: Projected vs Geographic Coordinate Reference Systems

Geographic coordinate reference systems are often used to make maps of the world. Projected coordinate reference systems are use to optimize spatial analysis for a region. Learn about WGS84 and UTM Coordinate Reference Systems as used in R.

last updated: 10 Jan 2018

## Coordinate Reference System and Spatial Projection

Coordinate reference systems are used to convert locations on the earth which is round, to a two dimensional (flat) map. Learn about the differences between coordinate reference systems.

last updated: 10 Jan 2018

## GIS in R: shp, shx and dbf + prj - The Files That Make up a Shapefile

This lesson reviews the core files that are required to use a shapefile including: shp, shx and dbf. It also covers the .prj format which is used to define the coordinate reference system (CRS) of the data.

last updated: 10 Jan 2018

## GIS in R: Intro to Vector Format Spatial Data - Points, Lines and Polygons

This lesson introduces what vector data are and how to open vector data stored in shapefile format in R.

last updated: 10 Jan 2018

## Clip Raster in R

You can clip a raster to a polygon extent to save processing time and make image sizes smaller. Learn how to crop a raster dataset in R.

last updated: 10 Jan 2018

## Classify a Raster in R.

This lesson presents how to classify a raster dataset and export it as a new raster in R.

last updated: 10 Jan 2018

## Create a Canopy Height Model With Lidar Data

A canopy height model contains height values trees and can be used to understand landscape change over time. Learn how to use LIDAR elevation data to calculate canopy height and change in terrain over time.

last updated: 10 Jan 2018

## How to Open and Use Files in Geotiff Format

A GeoTIFF is a standard file format with spatial metadata embedded as tags. Use the raster package in R to open geotiff files and spatial metadata programmatically.

last updated: 10 Jan 2018

## Plot Histograms of Raster Values in R

This lesson introduces the raster geotiff file format - which is often used to store lidar raster data. You learn the 3 key spatial attributes of a raster dataset including Coordinate reference system, spatial extent and resolution.

last updated: 10 Jan 2018

## Introduction to Lidar Raster Data Products

This lesson introduces the raster geotiff file format - which is often used to store lidar raster data. You learn the 3 key spatial attributes of a raster dataset including Coordinate reference system, spatial extent and resolution.

last updated: 10 Jan 2018

## How Lidar Point Clouds Are Converted to Raster Data Formats - Remote Sensing

This lesson reviews how a lidar data point cloud is converted to a raster format such as a geotiff.

last updated: 10 Jan 2018

## Introduction to Lidar Point Cloud Data - Active Remote Sensing

This lesson covers what a lidar point cloud is. We will use the free plas.io point cloud viewer to explore a point cloud.

last updated: 10 Jan 2018

## What is Lidar Data

This lesson reviews what lidar remote sensing is, what the lidar instrument measures and discusses the core components of a lidar remote sensing system.

last updated: 10 Jan 2018

## Layer a Raster Dataset Over a Hillshade Using R Baseplot to Create a Beautiful Basemap That Represents Topography

This lesson covers how to overlay raster data on a hillshade in R using baseplot and layer opacity arguments.

last updated: 10 Jan 2018

## Add a Basemap to an R Markdown Report Using ggmap

This lesson covers creating a basemap with the ggmap package in R. Given some ongoing bugs with ggmap it also covers the map package as a backup!

last updated: 10 Jan 2018