November 2018
Beginner to intermediate
354 pages
6h 59m
English
If we want to reclassify the NDVI into several categories, we can save the classification rule as a matrix and then provide it as the first argument to the reclassify() class. Suppose we want to classify all values between -1 and -0.5 as class 1, values between -0.5 and 0 as class 2, values between 0 and 0.2 as class 3, values between 0.2 and 0.5 as class 4 and values between 0.5 and 1 as class 5.
First, we define a matrix with these rules:
rules = c(-1, -0.5, 1, -0.5, 0, 2, 0, 0.2, 3, 0.2, 0.5, 4, 0.5, 1, 5) class = matrix(rules, ncol = 3, byrow = TRUE)
Now, we use the reclassify() function to reclassify the NDVI image according to the rules we just defined in class:
classified_ndvi = reclassify(NDVI, class)plot(classified_ndvi) ...
Read now
Unlock full access