Intro to Sentinel Processing

This is an R Markdown document. Markdown demonstates the basic sentinel processing using r https://www.rspatial.org.

Step1 Downloading required packages

The main packages we are going to be using here are basically the ratser and egdal nstalling them ifnot availlable .to install remember to type each in the console and hit enter then wait until it completes download then go ahead to install the other

#install.packages("raster")

#ininstall.packages("rgdal")

step2 Loading the libraries

write the bellow commands to load the libraries

#loading required packages for raster handling purposes
library(raster) #this is used for raster data handling and  processing
## Loading required package: sp
library(rgdal)#solves difficulties by reading the variouse formats
## rgdal: version: 1.5-12, (SVN revision 1018)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 3.0.4, released 2020/01/28
## Path to GDAL shared files: C:/Users/ShellHunter.DESKTOP-EO423F6/Documents/R/win-library/4.0/rgdal/gdal
## GDAL binary built with GEOS: TRUE 
## Loaded PROJ runtime: Rel. 6.3.1, February 10th, 2020, [PJ_VERSION: 631]
## Path to PROJ shared files: C:/Users/ShellHunter.DESKTOP-EO423F6/Documents/R/win-library/4.0/rgdal/proj
## Linking to sp version:1.4-2
## To mute warnings of possible GDAL/OSR exportToProj4() degradation,
## use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.

Step3 set working directry

setwd("C:/Users/ShellHunter.DESKTOP-EO423F6/Documents/rstudio/raster processing/data")

Step 4 Getting all the files from the working directory

this dependes on the file format of the bands whether its .jpg, .tiff, .grd e.t.c funtion used list.files()

bands<- list.files(recursive = TRUE, full.names = TRUE,pattern = ".tif")

Step 5 Finding the number of bands in the working directory

this can can be achieved by using the length function length()

length(bands)
## [1] 2

Step 6 this will display for you the top bands in the working directory

this can can be achieved by using the head function head()

head(bands)
## [1] "./s1b-iw-grd-vh-20190408t183312-20190408t183337-015719-01d7eb-002.tiff"
## [2] "./s1b-iw-grd-vv-20190408t183312-20190408t183337-015719-01d7eb-001.tiff"

Step 7 Reading and ploting a specific band

band2<-bands[2]# specifying the band number
#plot(band2)#ploting the band

getting to understand functions and their applications

use question mark followed by the function you want to understand ?plot

#?plot

Step 8 Layerstacking all the bands in the working directory

To achieve this use the function stack()

#sentinelstack<-stack(bands)

Step 9 specifying the layout while ploting two rows and two columns

To achieve this use the function par(mfrow=c())

par(mfrow=c(2,2))

Step 10 plotting true color

To achieve this use the function `plotRGB()``

#plotRGB(sentinelstack, 4,3,2, scale=65535, stretch='lin')