# Libraries
library(knitr)
library(units)
library(readxl)
library(sp)
library(raster)
library(tidyverse)
library(getlandsat)
library(sf)
library(mapview)
library(raster)
library(osmdata)
Figure 1: (4, 3, 2) Natural color . This is the closest true image bandwith. It is also prone to atmospheric interference
Figure 2: (5, 4, 3) Color infared with a lin color stretch. Color infared does a good job of differentiating different types of vegatation as well as the health of the vegetation.
Figure 3: (5, 6, 4) False color with a histogram color stretch. False color is good at seperating water from land in an image.
Figure 4: (6, 5, 2) False color for agriculture with a histogram color stretch. In this bandwith agricultural crops appear as a vibrant green, non-crop vegetation appears in a dull green, and bare earth appears in fuchsia.
# NVDI
x = (r$NIR - r$Red)/ (r$NIR + r$Red)
ndvi_func = function(x) {
ifelse(x < 0, 1, NA)
}
ndvi = calc(x, ndvi_func)
# NWDI
y = (r$Green - r$NIR)/ (r$NIR + r$Green)
nwdi_func = function(y) {
ifelse(y > 0, 1, NA)
}
ndwi = calc(y, nwdi_func)
# MNDWI
z = (r$Green - r$SWIR1)/ (r$SWIR1 + r$Green)
mnwdi_func = function(z) {
ifelse(z > 0, 1, NA)
}
mndwi = calc(z, mnwdi_func)
# WRI
a = (r$Green + r$Red)/ (r$SWIR1 + r$NIR)
wri_func = function(a) {
ifelse(a > 1, 1, NA)
}
wri = calc(a, wri_func)
# SWI
b = (1)/ sqrt(r$Blue - r$SWIR1)
swi_func = function(b) {
ifelse(b < 5, 1, NA)
}
swi = calc(b, swi_func)
Image band | Area(m2) |
---|---|
NDVI | 5998500 |
NDWI | 6489900 |
MNDWI | 10742400 |
WRI | 7621200 |
SWI | 13680900 |
k-means | 8194500 |