library(terra)
## terra 1.7.55
dNBR<-rast("Sebapala_dNBR.tif")
dNBR
## class : SpatRaster
## dimensions : 911, 1048, 1 (nrow, ncol, nlyr)
## resolution : 0.0002694946, 0.0002694937 (x, y)
## extent : 27.89862, 28.18105, -30.67576, -30.43025 (xmin, xmax, ymin, ymax)
## coord. ref. : lon/lat WGS 84 (EPSG:4326)
## source : Sebapala_dNBR.tif
## name : Sebapala_dNBR
## min value : -0.2924371
## max value : 0.2013500
#Loading and plotting dataset
hist(dNBR,main = "Delta Normalized Burn Ratio",xlab="dNBR")
boxplot(dNBR)
## Warning: [boxplot] taking a sample of 1e+05 cells
#Creating interactive leaflet map
library(leaflet)
library(terra)
pal <- colorNumeric("Spectral", domain = c(-1, 1))
leaflet() %>% addTiles("https://mts1.google.com/vt/lyrs=s&hl=en&src=app&x={x}&y={y}&z={z}&s=G") %>%
addRasterImage(dNBR,opacity = 0.7)%>%
addLegend(pal = pal, values = c(-1, 1),title = "dNBR value")%>%
addScaleBar(
dNBR,
position = "bottomright"
)
## Warning: [rast] 1 out of 2 elements of x are not a SpatRaster