En el siguiente ejercicio se visualiza un Modelo Digital de Elevación que cubre parcialmente el departamento del Cauca los municipios CAJIBÍO, PIENDAMÓ-TUNÍA, CALDONO, MORALES, SUÁREZ, SANTANDER DE QUILICHAO y BUENOS AIRES.

1. Se carga la librería raster previamente instalada

library(raster)
## Loading required package: 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/Antonio/Documents/R/win-library/4.0/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/Antonio/Documents/R/win-library/4.0/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/Antonio/Documents/R/win-library/4.0/rgdal/proj

2. Se busca el MDE por medio de la ruta de guardado.

setwd("C:\\Users\\Antonio\\Desktop\\PERCEPCION_REMOTA\\TALLER\\LAB_RASTER\\DEM")

3. Se confirma que la ruta este bien escrita

getwd()
## [1] "C:/Users/Antonio/Desktop/PERCEPCION_REMOTA/TALLER/LAB_RASTER"
GDALinfo("dem_zona4a_Clip21.tif")
## Warning in getProjectionRef(x, OVERRIDE_PROJ_DATUM_WITH_TOWGS84
## = OVERRIDE_PROJ_DATUM_WITH_TOWGS84, : Discarded datum
## Marco_Geocentrico_Nacional_de_Referencia in Proj4 definition: +proj=tmerc
## +lat_0=4.59620041666667 +lon_0=-77.0775079166667 +k=1 +x_0=1000000 +y_0=1000000
## +ellps=GRS80 +units=m +no_defs
## rows        15597 
## columns     19334 
## bands       1 
## lower left origin.x        991657 
## lower left origin.y        762083.2 
## res.x       5 
## res.y       5 
## ysign       -1 
## oblique.x   0 
## oblique.y   0 
## driver      GTiff 
## projection  +proj=tmerc +lat_0=4.59620041666667 +lon_0=-77.0775079166667 +k=1
## +x_0=1000000 +y_0=1000000 +ellps=GRS80 +units=m +no_defs 
## file        dem_zona4a_Clip21.tif 
## apparent band summary:
##    GDType hasNoDataValue   NoDataValue blockSize1 blockSize2
## 1 Float32           TRUE -3.402823e+38        128        128
## apparent band statistics:
##       Bmin     Bmax    Bmean      Bsd
## 1 39.63867 3819.635 1608.148 684.5148
## Metadata:
## AREA_OR_POINT=Area 
## DataType=Generic

Visualizamos la información como proyección, dimensiones, resolución extensión, nombre del archivo y valores máximo y mínimo

DEM <- raster("dem_zona4a_Clip21.tif")
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj
## = prefer_proj): Discarded datum Unknown based on GRS80 ellipsoid in Proj4
## definition
DEM
## class      : RasterLayer 
## dimensions : 15597, 19334, 301552398  (nrow, ncol, ncell)
## resolution : 5, 5  (x, y)
## extent     : 991657, 1088327, 762083.2, 840068.2  (xmin, xmax, ymin, ymax)
## crs        : +proj=tmerc +lat_0=4.59620041666667 +lon_0=-77.0775079166667 +k=1 +x_0=1000000 +y_0=1000000 +ellps=GRS80 +units=m +no_defs 
## source     : C:/Users/Antonio/Desktop/PERCEPCION_REMOTA/TALLER/LAB_RASTER/dem_zona4a_Clip21.tif 
## names      : dem_zona4a_Clip21 
## values     : 39.63867, 3819.635  (min, max)

5. Graficamos el MDE

plot(DEM)

6. Obtenemos las estadísticas descriptivas del raster

summary(DEM)
## Warning in .local(object, ...): summary is an estimate based on a sample of 1e+05 cells (0.03% of all cells)
##         dem_zona4a_Clip21
## Min.             48.35197
## 1st Qu.        1124.82178
## Median         1630.46954
## 3rd Qu.        1999.88800
## Max.           3781.19238
## NA's              0.00000