# install.packages("raster")
# install.packages("sp")
# install.packages("rgdal")
library(raster)
## Loading required package: sp
library(sp)
library(rgdal)
## rgdal: version: 1.5-23, (SVN revision 1121)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 3.2.1, released 2020/12/29
## Path to GDAL shared files: C:/Users/STEVEN/Documents/R/win-library/4.1/rgdal/gdal
## GDAL binary built with GEOS: TRUE
## Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]
## Path to PROJ shared files: C:/Users/STEVEN/Documents/R/win-library/4.1/rgdal/proj
## PROJ CDN enabled: FALSE
## Linking to sp version:1.4-5
## To mute warnings of possible GDAL/OSR exportToProj4() degradation,
## use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.
## Overwritten PROJ_LIB was C:/Users/STEVEN/Documents/R/win-library/4.1/rgdal/proj
# "llamar mis imagenes"
b2 <-raster("C:/Users/STEVEN/Google Drive/Universidad/10 Semestre/Geomatica - Electiva II/Sentinel/T18NVH_20170921T152631_B02.jp2")
b3 <-raster("C:/Users/STEVEN/Google Drive/Universidad/10 Semestre/Geomatica - Electiva II/Sentinel/T18NVH_20170921T152631_B03.jp2")
b4 <-raster("C:/Users/STEVEN/Google Drive/Universidad/10 Semestre/Geomatica - Electiva II/Sentinel/T18NVH_20170921T152631_B04.jp2")
b8 <-raster("C:/Users/STEVEN/Google Drive/Universidad/10 Semestre/Geomatica - Electiva II/Sentinel/T18NVH_20170921T152631_B08.jp2")
s<--stack(b8,b4,b3)
s
## class : RasterBrick
## dimensions : 10980, 10980, 120560400, 3 (nrow, ncol, ncell, nlayers)
## resolution : 10, 10 (x, y)
## extent : 399960, 509760, 190200, 3e+05 (xmin, xmax, ymin, ymax)
## crs : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
## source : r_tmp_2021-09-22_183240_12624_32972.grd
## names : T18NVH_20170921T152631_B08, T18NVH_20170921T152631_B04, T18NVH_20170921T152631_B03
## min values : -18743, -18724, -13880
## max values : -1, -1, -127
par(mfrow = c(2,2))
plot (b2,main = "blue", col = gray(0:100 /100))
plot (b3,main = "gren", col = gray(0:100 /100))
plot (b4,main = "red", col = gray(0:100 /100))
plot (b8,main = "infrared", col = gray(0:100 /100))
♣
# Stack o combinacion a probar colores
SentinelRGB <--stack(b8,b3,b2)
plotRGB(SentinelRGB, axes = TRUE, stretch = "lin", main = "Sentinel Probando Colores")
extent(SentinelRGB)
## class : Extent
## xmin : 399960
## xmax : 509760
## ymin : 190200
## ymax : 3e+05
area_recorte <- extent(399960, 469000, 238000, 3e+05)
Sentinelrecortada <-- crop(SentinelRGB,area_recorte)
#plotRGB(Sentinelrecortada)
plotRGB(Sentinelrecortada, axes = TRUE, stretch = "lin", main = "Sentinel Probando Colores")