En este cuaderno se obtiene un conjunto de datos de imágenes satelitales para el área de estudio. Generalmente, se lleva a cabo a través de una serie de aplicaciones web configuradas por los proveedores de datos. Lo que significa que esta tarea se realiza de forma independiente de los otros procesos de investigación.
Se utiliza el paquete getSpatialData cuya función es proporcionar paquetes de funciones homogéneos para poder consultar, descargar, preparar y transformar varios tipos de conjuntos de datos espaciales de fuentes abiertas, incluidos los datos sensoriales satelitales.
###. Configuración.
library(getSpatialData)
library(raster)
## Loading required package: sp
library(sf)
## Linking to GEOS 3.9.1, GDAL 3.3.2, PROJ 7.2.1; sf_use_s2() is TRUE
library(sp)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.7 ✔ dplyr 1.0.9
## ✔ tidyr 1.2.0 ✔ stringr 1.4.0
## ✔ readr 2.1.2 ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ tidyr::extract() masks raster::extract()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ✖ dplyr::select() masks raster::select()
regions <- st_read("C:/Users/GERARDO/Desktop/GB2022/datos/Cocuy.geojson")
## Reading layer `Cocuy' from data source
## `C:\Users\GERARDO\Desktop\GB2022\Datos\Cocuy.geojson' using driver `GeoJSON'
## Simple feature collection with 1 feature and 9 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -72.51775 ymin: 6.270376 xmax: -72.31488 ymax: 6.440008
## Geodetic CRS: WGS 84
str(regions)
## Classes 'sf' and 'data.frame': 1 obs. of 10 variables:
## $ DPTO_CCDGO: chr "15"
## $ MPIO_CCDGO: chr "15244"
## $ MPIO_CNMBR: chr "EL COCUY"
## $ MPIO_CRSLC: chr "1725"
## $ MPIO_NAREA: num 238
## $ MPIO_NANO : int 2017
## $ DPTO_CNMBR: chr "BOYACÁ"
## $ Shape_Leng: num 0.716
## $ Shape_Area: num 0.0195
## $ geometry :sfc_MULTIPOLYGON of length 1; first list element: List of 1
## ..$ :List of 1
## .. ..$ : num [1:2646, 1:2] -72.4 -72.4 -72.4 -72.4 -72.4 ...
## ..- attr(*, "class")= chr [1:3] "XY" "MULTIPOLYGON" "sfg"
## - attr(*, "sf_column")= chr "geometry"
## - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA NA NA
## ..- attr(*, "names")= chr [1:9] "DPTO_CCDGO" "MPIO_CCDGO" "MPIO_CNMBR" "MPIO_CRSLC" ...
p <- ggplot(regions) +
geom_sf(aes(fill = MPIO_NAREA), colour="white")
p + geom_sf_label(aes(label = MPIO_CNMBR), colour = "black", size = 2.0)
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data
ElCocuy <-
regions %>%
summarise(area = sum(MPIO_NAREA))
ElCocuy
## Simple feature collection with 1 feature and 1 field
## Geometry type: POLYGON
## Dimension: XY
## Bounding box: xmin: -72.51775 ymin: 6.270376 xmax: -72.31488 ymax: 6.440008
## Geodetic CRS: WGS 84
## area geometry
## 1 238.3446 POLYGON ((-72.42843 6.43307...
p <- ggplot(ElCocuy) + geom_sf(aes(fill = area), colour="black")
p + geom_sf_text(aes(label = "El Cocuy"), colour = "white", size = 5.0)
## Warning in st_point_on_surface.sfc(sf::st_zm(x)): st_point_on_surface may not
## give correct results for longitude/latitude data
set_aoi(st_geometry(ElCocuy))
view_aoi() #view AOI in viewer, which will look like this: