Datos Espaciales



Dr. Felipe Dzul Manzanilla

Dr. Fabián Correa-Morales


Date: 2024-01-01

Update: 2024-01-23


Temario


  • Datos Espaciales
  • Tipos de Mapas
  • Mapas estáticos en R
    • Base R
    • ggplot2
    • tmap
    • mapsf
  • Mapas Interactivos en R

    • leaflet
    • mapview
    • tmap
    • plotly
  • Mapas Animados

  • Mapas en 3D

Clasificación de los Datos Espaciales


Tipos de mapas


Datos Espaciales


Areal Data-Irregular

Areal Data-Regular

Mapas Estáticos


# step 1. load municipality & add the dengue cases ####
library(sf)
x <- rgeomex::AGEM_inegi19_mx |>
    dplyr::filter(CVE_ENT %in% c("30")) |>
    dplyr::mutate(casos = rpois(n = dplyr::n(), 
                                lambda = 4))
# Step 2. plot the map with R base ####
plot(x["casos"], 
     key.pos = 4,
     axes = TRUE, 
     graticule = TRUE,
     key.width = .2,
     key.length = .8)

# step 1. load municipality & add the dengue cases ####
library(sf)
x <- rgeomex::AGEM_inegi19_mx |>
    dplyr::filter(CVE_ENT %in% c("30")) |>
    dplyr::mutate(casos = rpois(n = dplyr::n(), 
                                lambda = 4)) 

# Step 2. plot the map with ggplot2 ####
ggplot2::ggplot() +
    ggplot2::geom_sf(data = x,
                     ggplot2::aes(fill = casos)) +
    fishualize::scale_fill_fish() +
    ggspatial::annotation_scale(location = "bl") +
    ggspatial::annotation_north_arrow(location = "tr")

# step 1. load municipality & add the dengue cases ####
library(sf)
x <- rgeomex::AGEM_inegi19_mx |>
    dplyr::filter(CVE_ENT %in% c("30")) |>
    dplyr::mutate(casos = rpois(n = dplyr::n(), 
                                lambda = 4))
# Step 2. plot the map with tmap ####
library(tmap)
tmap::tm_shape(x) +
    tmap::tm_polygons(col = "casos") +
    tmap::tm_compass(position = c(.2, .9)) +
    tmap::tm_scale_bar(position = c(.1, .02))

Mapas Interactivos


Mapas Estatico vs Interactivo


Mapas Animados


Dios Botic