UNIVERSIDAD COOPERATIVA DE COLOMBIA

Facultad de Ingenieria

PRACTICA 4

Integrantes:

Andres Felipe Rivas

Instalamos los paquetes y los llamamos

library(raster)
## Loading required package: sp
library(sp)
library(sf)
## Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1
library(rgdal)
## Please note that rgdal will be retired by the end of 2023,
## plan transition to sf/stars/terra functions using GDAL and PROJ
## at your earliest convenience.
## 
## rgdal: version: 1.5-25, (SVN revision 1143)
## 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/felip/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/felip/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 sp or rgdal.
## Overwritten PROJ_LIB was C:/Users/felip/Documents/R/win-library/4.1/rgdal/proj
library(readxl) 
library(writexl)

Bandas a llamar

b4<-raster("C:/Users/felip/Desktop/electiva2/Practica4/FACADE/facade_b04.tif")
b5<-raster("C:/Users/felip/Desktop/electiva2/Practica4/FACADE/facade_b05.tif")
b6<-raster("C:/Users/felip/Desktop/electiva2/Practica4/FACADE/facade_b06.tif")
b7<-raster("C:/Users/felip/Desktop/electiva2/Practica4/FACADE/facade_b07.tif")
b8<-raster("C:/Users/felip/Desktop/electiva2/Practica4/FACADE/facade_b08.tif")
b9<-raster("C:/Users/felip/Desktop/electiva2/Practica4/FACADE/facade_b09.tif")
b10<-raster("C:/Users/felip/Desktop/electiva2/Practica4/FACADE/facade_b10.tif")
b11<-raster("C:/Users/felip/Desktop/electiva2/Practica4/FACADE/facade_b11.tif")
b12<-raster("C:/Users/felip/Desktop/electiva2/Practica4/FACADE/facade_b12.tif")
b13<-raster("C:/Users/felip/Desktop/electiva2/Practica4/FACADE/facade_b13.tif")
b14<-raster("C:/Users/felip/Desktop/electiva2/Practica4/FACADE/facade_b14.tif")
b15<-raster("C:/Users/felip/Desktop/electiva2/Practica4/FACADE/facade_b15.tif")

Vemos las bandas para su analisis

b4
## class      : RasterLayer 
## dimensions : 800, 1000, 8e+05  (nrow, ncol, ncell)
## resolution : 0.1, 0.1  (x, y)
## extent     : 40000, 40100, 2e+05, 200080  (xmin, xmax, ymin, ymax)
## crs        : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs 
## source     : facade_b04.tif 
## names      : facade_b04 
## values     : 0, 66  (min, max)
b5
## class      : RasterLayer 
## dimensions : 800, 1000, 8e+05  (nrow, ncol, ncell)
## resolution : 0.1, 0.1  (x, y)
## extent     : 40000, 40100, 2e+05, 200080  (xmin, xmax, ymin, ymax)
## crs        : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs 
## source     : facade_b05.tif 
## names      : facade_b05 
## values     : 0, 76  (min, max)
b6
## class      : RasterLayer 
## dimensions : 800, 1000, 8e+05  (nrow, ncol, ncell)
## resolution : 0.1, 0.1  (x, y)
## extent     : 40000, 40100, 2e+05, 200080  (xmin, xmax, ymin, ymax)
## crs        : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs 
## source     : facade_b06.tif 
## names      : facade_b06 
## values     : 0, 78  (min, max)
b7
## class      : RasterLayer 
## dimensions : 800, 1000, 8e+05  (nrow, ncol, ncell)
## resolution : 0.1, 0.1  (x, y)
## extent     : 40000, 40100, 2e+05, 200080  (xmin, xmax, ymin, ymax)
## crs        : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs 
## source     : facade_b07.tif 
## names      : facade_b07 
## values     : 0, 76  (min, max)
b8
## class      : RasterLayer 
## dimensions : 800, 1000, 8e+05  (nrow, ncol, ncell)
## resolution : 0.1, 0.1  (x, y)
## extent     : 40000, 40100, 2e+05, 200080  (xmin, xmax, ymin, ymax)
## crs        : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs 
## source     : facade_b08.tif 
## names      : facade_b08 
## values     : 2, 50  (min, max)
b9
## class      : RasterLayer 
## dimensions : 800, 1000, 8e+05  (nrow, ncol, ncell)
## resolution : 0.1, 0.1  (x, y)
## extent     : 40000, 40100, 2e+05, 200080  (xmin, xmax, ymin, ymax)
## crs        : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs 
## source     : facade_b09.tif 
## names      : facade_b09 
## values     : 3, 71  (min, max)
b10
## class      : RasterLayer 
## dimensions : 800, 1000, 8e+05  (nrow, ncol, ncell)
## resolution : 0.1, 0.1  (x, y)
## extent     : 40000, 40100, 2e+05, 200080  (xmin, xmax, ymin, ymax)
## crs        : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs 
## source     : facade_b10.tif 
## names      : facade_b10 
## values     : 3, 79  (min, max)
b11
## class      : RasterLayer 
## dimensions : 800, 1000, 8e+05  (nrow, ncol, ncell)
## resolution : 0.1, 0.1  (x, y)
## extent     : 40000, 40100, 2e+05, 200080  (xmin, xmax, ymin, ymax)
## crs        : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs 
## source     : facade_b11.tif 
## names      : facade_b11 
## values     : 3, 80  (min, max)
b12
## class      : RasterLayer 
## dimensions : 800, 1000, 8e+05  (nrow, ncol, ncell)
## resolution : 0.1, 0.1  (x, y)
## extent     : 40000, 40100, 2e+05, 200080  (xmin, xmax, ymin, ymax)
## crs        : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs 
## source     : facade_b12.tif 
## names      : facade_b12 
## values     : 0, 43  (min, max)
b13
## class      : RasterLayer 
## dimensions : 800, 1000, 8e+05  (nrow, ncol, ncell)
## resolution : 0.1, 0.1  (x, y)
## extent     : 40000, 40100, 2e+05, 200080  (xmin, xmax, ymin, ymax)
## crs        : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs 
## source     : facade_b13.tif 
## names      : facade_b13 
## values     : 0, 66  (min, max)
b14
## class      : RasterLayer 
## dimensions : 800, 1000, 8e+05  (nrow, ncol, ncell)
## resolution : 0.1, 0.1  (x, y)
## extent     : 40000, 40100, 2e+05, 200080  (xmin, xmax, ymin, ymax)
## crs        : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs 
## source     : facade_b14.tif 
## names      : facade_b14 
## values     : 0, 66  (min, max)
b15
## class      : RasterLayer 
## dimensions : 800, 1000, 8e+05  (nrow, ncol, ncell)
## resolution : 0.1, 0.1  (x, y)
## extent     : 40000, 40100, 2e+05, 200080  (xmin, xmax, ymin, ymax)
## crs        : +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs 
## source     : facade_b15.tif 
## names      : facade_b15 
## values     : 1, 79  (min, max)

observamos otros arguamentos

crs(b4) 
## CRS arguments:
##  +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
crs(b5)
## CRS arguments:
##  +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
crs(b6)
## CRS arguments:
##  +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
crs(b7)
## CRS arguments:
##  +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
crs(b8)
## CRS arguments:
##  +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
crs(b9)
## CRS arguments:
##  +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
crs(b10)
## CRS arguments:
##  +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
crs(b11)
## CRS arguments:
##  +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
crs(b12)
## CRS arguments:
##  +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
crs(b13)
## CRS arguments:
##  +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
crs(b14)
## CRS arguments:
##  +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
crs(b15)
## CRS arguments:
##  +proj=utm +zone=18 +datum=WGS84 +units=m +no_defs
#resolucion espacial

res(b4)
## [1] 0.1 0.1

creamos el stack para plotear

FacadeB <- stack(b4, b5, b6, b7, b8 ,b9 ,b10, b11 ,b12 ,b13 ,b14 ,b15)

*PLotemos sin color verdadero las bandas anteriores FACADE

par(mfrow = c(2,5))
plot(b4,main = "banda 4", col = gray(0:100 / 100))
plot(b5,main = "banda 5", col = gray(0:100 / 100))
plot(b6,main = "banda 6", col = gray(0:100 / 100))
plot(b7,main = "banda 7", col = gray(0:100 / 100))
plot(b8,main = "banda 8", col = gray(0:100 / 100))
plot(b9,main = "banda 9", col = gray(0:100 / 100))
plot(b10,main = "banda 10", col = gray(0:100 / 100))
plot(b11,main = "banda 11", col = gray(0:100 / 100))
plot(b12,main = "banda 12", col = gray(0:100 / 100))
plot(b13,main = "banda 13", col = gray(0:100 / 100))

plot(b14,main = "banda 14", col = gray(0:100 / 100))
plot(b15,main = "banda 15", col = gray(0:100 / 100))

extent(FacadeB) 
## class      : Extent 
## xmin       : 40000 
## xmax       : 40100 
## ymin       : 2e+05 
## ymax       : 200080

renombramos y creamos el excel training

FacadeB_subset <- stack(b4, b5, b6, b7, b8 ,b9 ,b10, b11 ,b12 ,b13 ,b14 ,b15)


names(FacadeB_subset) <- c("banda 4", "banda 5", "banda 6", "banda 7", "banda 8", "banda 9", "banda 10", "banda 11", "banda 12", "banda 13", "banda 14", "banda 15")


training <- read_xlsx("C:/Users/felip/Desktop/electiva2/Practica4/training.xlsx")

training <- training %>%
st_as_sf(coords = c("x", "y"))

plot (training$geometry)

df <- extract (FacadeB_subset, training); df
##        banda.4 banda.5 banda.6 banda.7 banda.8 banda.9 banda.10 banda.11
##   [1,]       0       0       0       0       3       4        5        5
##   [2,]       0       0       0       0       3       4        5        5
##   [3,]       0       0       0       0       3       4        5        5
##   [4,]       0       0       0       0       3       4        5        5
##   [5,]       0       0       0       0       3       4        5        5
##   [6,]       0       0       0       0       3       4        5        5
##   [7,]       0       0       0       0       3       4        5        5
##   [8,]       0       0       0       0       3       4        5        5
##   [9,]       0       0       0       0       3       4        5        5
##  [10,]       0       0       1       0       6       9       10       10
##  [11,]       0       0       1       0       6       9       10       10
##  [12,]       0       0       1       0       6       9       10       10
##  [13,]       0       0       1       0       6       9       10       10
##  [14,]       0       0       1       0       6       9       10       10
##  [15,]       0       0       1       0       6       9       10       10
##  [16,]       0       0       1       0       6       9       10       10
##  [17,]       0       0       1       0       6       9       10       10
##  [18,]       0       0       2       0      10      14       15       16
##  [19,]       0       0       2       0      10      14       15       16
##  [20,]       0       0       2       0      10      14       15       16
##  [21,]       0       0       2       0      10      14       15       16
##  [22,]       0       0       2       0      10      14       15       16
##  [23,]       0       0       2       0      10      14       15       16
##  [24,]       0       0       2       0      10      14       15       16
##  [25,]       0       0       2       0      10      14       15       16
##  [26,]      65      75      77      75      20      70       78       32
##  [27,]      62      72      74      72      48      68       75       77
##  [28,]      65      75      77      75      49      70       78       78
##  [29,]      65      75      77      75      49      70       78       78
##  [30,]      65      75      77      75      49      70       78       78
##  [31,]      65      75      77      75      49      70       78       78
##  [32,]      21      31      33      31      22      31       34       35
##  [33,]      65      75      77      75      49      70       78       78
##  [34,]      22      32      34      32      22      32       35       35
##  [35,]      65      75      77      75      49      70       78       78
##  [36,]      65      75      77      75      49      70       78       78
##  [37,]      22      32      34      32      22      32       35       35
##  [38,]      22      32      34      32      22      32       35       35
##  [39,]      65      75      77      75      49      70       78       78
##  [40,]      65      75      77      75      49      70       78       78
##  [41,]      23      33      35      33      22      32       36       35
##  [42,]      24      34      36      34      23      33       37       37
##  [43,]      65      75      77      75      49      70       78       78
##  [44,]      25      35      37      35      24      34       38       38
##  [45,]      65      75      77      75      49      70       78       78
##  [46,]      65      75      77      75      49      70       78       78
##  [47,]      65      75      77      75      49      70       78       78
##  [48,]      65      75      77      75      49      70       78       78
##  [49,]      65      75      77      75      49      70       78       78
##  [50,]      62      72      74      72      48      68       75       77
##  [51,]      65      75      77      75      49      70       78       78
##  [52,]      65      75      77      75      49      70       78       78
##  [53,]      62      72      74      72      48      68       75       77
##  [54,]      65      75      77      75      49      70       78       78
##  [55,]      24      34      36      34      23      33       37       37
##  [56,]      65      75      77      75      49      70       78       78
##  [57,]      65      75      77      75      49      70       78       78
##  [58,]      65      75      77      75      49      70       78       78
##  [59,]      62      72      74      72      48      68       75       77
##  [60,]      62      72      74      72      19      68       75       30
##  [61,]      62      72      74      72      48      68       75       77
##  [62,]      65      75      77      75      49      70       78       78
##  [63,]      62      72      74      72      48      68       75       77
##  [64,]      63      73      75      73      48      68       76       77
##  [65,]      63      73      75      73      48      68       76       77
##  [66,]      63      73      75      73      48      68       76       77
##  [67,]      65      75      77      75      49      70       78       78
##  [68,]      64      74      76      74      48      69       77       77
##  [69,]      65      75      77      75      49      70       78       78
##  [70,]      65      75      77      75      49      70       78       78
##  [71,]      64      74      76      74      48      69       77       77
##  [72,]      65      75      77      75      49      70       78       78
##  [73,]      65      75      77      75      49      70       78       78
##  [74,]      64      74      76      74      48      69       77       77
##  [75,]      64      74      76      74      48      69       77       77
##  [76,]      64      74      76      74      48      69       77       77
##  [77,]      65      75      77      75      49      70       78       78
##  [78,]      64      74      76      74      19      69       77       30
##  [79,]      65      75      77      75      49      70       78       78
##  [80,]      65      75      77      75      49      70       78       78
##  [81,]      65      75      77      75      49      70       78       78
##  [82,]      65      75      77      75      49      70       78       78
##  [83,]      65      75      77      75      49      70       78       78
##  [84,]      65      75      77      75      49      70       78       78
##  [85,]      65      75      77      75      49      70       78       78
##  [86,]      65      75      77      75      20      70       78       32
##  [87,]      65      75      77      75      49      70       78       78
##  [88,]      65      75      77      75      49      70       78       78
##  [89,]      65      75      77      75      49      70       78       78
##  [90,]       0       0       2       0      10      14       15       16
##  [91,]      65      75      77      75      20      70       78       32
##  [92,]      65      75      77      75      49      70       78       78
##  [93,]      65      75      77      75      49      70       78       78
##  [94,]      65      75      77      75      20      70       78       32
##  [95,]      65      75      77      75      49      70       78       78
##  [96,]      65      75      77      75      49      70       78       78
##  [97,]      65      75      77      75      49      70       78       78
##  [98,]      66      76      78      76      50      71       79       80
##  [99,]      65      75      77      75      49      70       78       78
## [100,]      66      76      78      76      50      71       79       80
##        banda.12 banda.13 banda.14 banda.15
##   [1,]        0        0        0        1
##   [2,]        0        0        0        1
##   [3,]        0        0        0        1
##   [4,]        0        0        0        1
##   [5,]        0        0        0        1
##   [6,]        0        0        0        1
##   [7,]        0        0        0        1
##   [8,]        0        0        0        1
##   [9,]        0        0        0        1
##  [10,]        0        0        0        2
##  [11,]        0        0        0        2
##  [12,]        0        0        0        2
##  [13,]        0        0        0        2
##  [14,]        0        0        0        2
##  [15,]        0        0        0        2
##  [16,]        0        0        0        2
##  [17,]        0        0        0        2
##  [18,]        0        0        0        3
##  [19,]        0        0        0        3
##  [20,]        0        0        0        3
##  [21,]        0        0        0        3
##  [22,]        0        0        0        3
##  [23,]        0        0        0        3
##  [24,]        0        0        0        3
##  [25,]        0        0        0        3
##  [26,]       42       65       65       78
##  [27,]       39       62       62       75
##  [28,]       42       65       65       78
##  [29,]       42       65       65       78
##  [30,]       42       65       65       78
##  [31,]       42       65       65       78
##  [32,]        0       21       21       34
##  [33,]       42       65       65       78
##  [34,]        0       22       22       35
##  [35,]       42       65       65       78
##  [36,]       42       65       65       78
##  [37,]        0       22       22       35
##  [38,]        0       22       22       35
##  [39,]       42       65       65       78
##  [40,]       42       65       65       78
##  [41,]        0       23       23       36
##  [42,]        1       24       24       37
##  [43,]       42       65       65       78
##  [44,]        2       25       25       38
##  [45,]       42       65       65       78
##  [46,]       42       65       65       78
##  [47,]       42       65       65       78
##  [48,]       42       65       65       78
##  [49,]       42       65       65       78
##  [50,]       39       62       62       75
##  [51,]       42       65       65       78
##  [52,]       42       65       65       78
##  [53,]       39       62       62       75
##  [54,]       42       65       65       78
##  [55,]        1       24       24       37
##  [56,]       42       65       65       78
##  [57,]       42       65       65       78
##  [58,]       42       65       65       78
##  [59,]       39       62       62       75
##  [60,]       39       62       62       75
##  [61,]       39       62       62       75
##  [62,]       42       65       65       78
##  [63,]       39       62       62       75
##  [64,]       40       63       63       76
##  [65,]       40       63       63       76
##  [66,]       40       63       63       76
##  [67,]       42       65       65       78
##  [68,]       41       64       64       77
##  [69,]       42       65       65       78
##  [70,]       42       65       65       78
##  [71,]       41       64       64       77
##  [72,]       42       65       65       78
##  [73,]       42       65       65       78
##  [74,]       41       64       64       77
##  [75,]       41       64       64       77
##  [76,]       41       64       64       77
##  [77,]       42       65       65       78
##  [78,]       41       64       64       77
##  [79,]       42       65       65       78
##  [80,]       42       65       65       78
##  [81,]       42       65       65       78
##  [82,]       42       65       65       78
##  [83,]       42       65       65       78
##  [84,]       42       65       65       78
##  [85,]       42       65       65       78
##  [86,]       42       65       65       78
##  [87,]       42       65       65       78
##  [88,]       42       65       65       78
##  [89,]       42       65       65       78
##  [90,]        0        0        0        3
##  [91,]       42       65       65       78
##  [92,]       42       65       65       78
##  [93,]       42       65       65       78
##  [94,]       42       65       65       78
##  [95,]       42       65       65       78
##  [96,]       42       65       65       78
##  [97,]       42       65       65       78
##  [98,]       43       66       66       79
##  [99,]       42       65       65       78
## [100,]       43       66       66       79
ms <- aggregate(df, list(training$class), mean)

exportamos el excel para graficar

#write_xlsx(ms,"C:/Users/felip/Desktop/electiva2/Practica4/file_name.xlsx")

Cual es la resolucion espacial de las bandas?

la resolucion es 0.1um, 0.1um en cada banda es igual. #esto se convierte a metros

En cuales bandas la reflectancia es igual entre clases?

La banda 5,7 ya que en la grafica se mantuvieron constantes sobre reflectancia 10

Cual banda da mejor respuesta a cada clase?

La que mejor da reflectancia es la b10 y la menor la b12

Conclusiones

#Las bandas de la clase gap son las que tienen una reflectancia menor a las otras.

#La clase wall tiene una reflectancia mayora todas.

#La clase fissure y wall tienen reflectancias muy inestables.

#La banda 12 es la que tiene menor reflectancia entre todas las clases

#La longitud de banda es mayor en la clase wall