Table of Contents
W04-2: Land cover classification
Once training sites are available, we can start with classifying the Landsat scene. In this worksheet, we will use Random Forest as a classifier.
Things you need for this worksheet
R Studio — we recommend to use R Studio for (interactive) programming with R. You can download R Studio from the official web page.
Learning log assignments
Load the cropped Landsat bands 1-7 and the training site shapefile into R. Make sure that both datasets are in the same projection.
Extract the information of the landsat bands for the location of the training sites. Return the results as a data.frame
Add a new column to the data.frame which contains the land cover information from the training site shapefile
Split your dataset into training and testing data (e.g. 30% Testing, 70% Training).
Use the training dataset to train a random forest model that is able to predict the land cover class from the spectral Landsat bands.
Explore which bands were important in the model
Use the model to predict on the entire Landsat scene. Plot your results with spplot.