Make sure you can install and load all packages. This includes
terra
and sf
, but also the
tidyverse
.
# Insert code here
# End
Next, go to https://www.naturalearthdata.com and download the “Small scale data, 1:110m” > “Cultural” > “Admin 1 – States, Provinces” data set. Additionally, download the “NLCD 2019 Land Cover (CONUS)” data set from https://www.mrlc.gov.
Once you downloaded all the data, read it into your R Session using the corresponding packages.
# Insert code here
# End
Make sure both the vector and the raster data have the same CRS (Hint: It’s often faster to project vectors instead of raster. If projecting the raster, have a look at the ‘method’ argument).
# Insert code here
# End
Next, remove Alaska and Hawaii from the states vector because there is no NLCD data for these states. Next select only the 5 largest states in area
# Insert code here
# End
First plot the NLCD data and add the largest states to the map. Try to use the region as shape fill.
# Insert code here
# End
Now, pick one state (your home state, a state you recently visited, a state you want to visit, …) and get the NLCD data for that state only.
# Insert code here
# End
Next, get all values of the cropped NLCD data and remove all
NA
and NaN
values. Calculate the relative
amount of all remaining values. Which one is the most dominant
land-cover class in your state?
# Insert code here
# End
Last, try to reclassify the raster into less classes (e.g., use the bigger classification found atNLCD classes)
# Insert code here
# End