Paula Juliana Virguez Gomez
30 de marzo de 2020
rm(list = ls())
library(raster)
dem <- raster(ncol=3, nrow=3, xmn=100, xmx=115, ymn=100, ymx=115)
CuƔntas celdas compone el DEM
ncell(dem)
[1] 9
Resolución espacial o tamaño de celda
res(dem)
[1] 5 5
Asignar valores de elevación a los DEM:
valores <- c(50, 45, 50, 30, 30, 30, 8, 10, 10)
(values(dem) <- valores)
[1] 50 45 50 30 30 30 8 10 10
Visualizar los DEM a lo largo de los valores de elevación:
plot(dem, main = "DEM")
text(dem)
Asignar un sistema de referencia de coordenadas a los DEM:
crs(dem) <- CRS('+init=epsg:3115')
Calculo de la pendiente y orientación
(slope = terrain(dem, 'slope', unit='degrees', neighbors=8))
class : RasterLayer
dimensions : 3, 3, 9 (nrow, ncol, ncell)
resolution : 5, 5 (x, y)
extent : 100, 115, 100, 115 (xmin, xmax, ymin, ymax)
crs : +init=epsg:3115
source : memory
names : slope
values : 75.25766, 75.25766 (min, max)
plot(slope, main = "Pendiente")
text(slope)
(aspecto = terrain(dem, 'aspect', unit='degrees', neighbors=8))
class : RasterLayer
dimensions : 3, 3, 9 (nrow, ncol, ncell)
resolution : 5, 5 (x, y)
extent : 100, 115, 100, 115 (xmin, xmax, ymin, ymax)
crs : +init=epsg:3115
source : memory
names : aspect
values : 180.7538, 180.7538 (min, max)
plot(aspecto, main = "Aspecto")
text(aspecto)
TAREA
dem_tarea <-raster(ncol=4, nrow=4, xmn=100, xmx=120, ymn=100, ymx=120)
ncell(dem_tarea)
[1] 16
res(dem_tarea)
[1] 5 5
valores_tarea <- c (50,45,50,48,30,29,30,29,10,9,9,10,26,23,19,21)
(values(dem_tarea) <- valores_tarea)
[1] 50 45 50 48 30 29 30 29 10 9 9 10 26 23 19 21
plot(dem_tarea, main= "DEM2")
text(dem_tarea)
MAGNA-SIRGAS / Colombia Far West zone
crs(dem_tarea) <- CRS('+init=epsg:3114')
Pendiente
(slope = terrain(dem_tarea, 'slope', unit='degrees', neighbors=8))
class : RasterLayer
dimensions : 4, 4, 16 (nrow, ncol, ncell)
resolution : 5, 5 (x, y)
extent : 100, 120, 100, 120 (xmin, xmax, ymin, ymax)
crs : +init=epsg:3114
source : memory
names : slope
values : 35.43233, 75.62313 (min, max)
plot(slope,main="Pendiente")
text(slope)
Aspecto
(aspecto2= terrain(dem_tarea, 'aspect', unit='degrees', neighbors=8))
class : RasterLayer
dimensions : 4, 4, 16 (nrow, ncol, ncell)
resolution : 5, 5 (x, y)
extent : 100, 120, 100, 120 (xmin, xmax, ymin, ymax)
crs : +init=epsg:3114
source : memory
names : aspect
values : 161.5651, 181.4688 (min, max)
plot(aspecto2,main="Aspecto")
text(aspecto2)