1. ¿Qué es la cartografía temática?

Progresivamente la humanidad ha tenido un interés creciente por obtener información acerca de las dinámicas poblacionales, la fluctación de las variables meteorológicas, la distribución de los recursos naturales, entre otros. En consecuencia, se desarrolló la cartografía temática con el objetivo de tener representaciones de la superficie terrestre que permitan simplificar e interpretar de mejor manera fenómenos sociales o científicos (Dávila, 2008)

Los mapas temáticos están compuestos básicamente por dos elementos: el contenido base o geográfico y el contenido específico o temático. El primero provee información espacial sobre la cual se va a referenciar la temática escogida. El usario debe ser capaz de integrar ambas partes visual y mentalmnente mientras realiza la lectura del mapa (Asociación internacional de cartografía). Existen diferentes tipos de mapas temáticos que se explicaran a continuación

1.1 Mapas cloropléticos

Son utilizados para la representación de fenómenos discretos asociados a unidades de enumeración (paises, departamentos, municipios). Usualmente utilizan escalas de color para representar magnitudes de una misma variable (densidad poblacional, volumen de producción, renta per cápita, entre otros).

1.2 Mapas de símbolos graduados o proporcionales

En estos mapas se representa una información cuantitativa por medio de un símbolo (círculo, cudarado, rombo) que cambia de tamaño de acuerdo con la variación en la magnitud de la variable estudiada. Generalmente, los datos a representar están asociados con unidades administrativas.

1.4 Mapa de puntos

Sirven para representar información cuantitativa por medio de la repetición de puntos, que a deiferencia de los mapas de símbolos proporcionales, no varían de tamaño. En estos mapas cada punto representa un valor unitario, estos se acumulan en cierta área hasta alcanzar el valor que tenga la variable en cada unidad administrativa. Esta representación de una temática es muy útil para identificar la distribución que tiene las variables de naturaleza discreta (población, cabezas de ganado, etc.)

1.4 Mapa de isolíneas

Corresponde una representación bidimensional de un volumen o superficie suavizada.Este mapa temático es ideal para la representación de variables continuas. Se basa en el uso de isolíneas, las cuales corresponden a líneas que unen puntos de igual valor. Dichos puntos provienen de mediciones y de interpolaciones de las mismas.

2. Obtención y preparación de los datos

Los datos usados para este informe corresponden al reporte hecho por el DANE en el año 2018 de las Necesidades Básicas Insatisfechas para todos los municipios de Colombia.

El método de NBI sirven para identificar las carencias críticas en una población y así mismo caracterizar la pobreza. Usualmente hace uso de los siguientes indicadores (Feres y Mancero, 2001): 1. Acceso a vivienda: tiene en cuenta la calidad de la misma y el hacinamiento 2. Acceso a servicios sanitarios: referente a la disponibilidad de agua potable y sistema de eliminación de excretas 3. Acceso a educación: asistencia de los niños en edad escolar en un establecimiento educativo 4. Capacidad económica: probabilidad de insuficiencia de ingresos en el hogar

Los datos utilizados se encuentran de forma gratuita en el geoportal. Estos deben ser filtrados ya que los municipios de interés son los ubicados en Cundinamarca.

3. Preparación

Inicialmente, se debe limpiar la memoria

rm(list=ls())

Se instalan las librerias “tidyverse”, “rgeos”, “sf”, “raster”, “cartography y”SpatialPosition", las cuales se requieren para realizar los mapas temáticos

list.of.packages <- c("tidyverse", "rgeos", "sf", "raster", "cartography", "SpatialPosition")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
library(tidyverse)
## -- Attaching packages ------------------------------------------------------------------------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.2     v purrr   0.3.4
## v tibble  3.0.2     v dplyr   1.0.0
## v tidyr   1.1.0     v stringr 1.4.0
## v readr   1.3.1     v forcats 0.5.0
## -- Conflicts ---------------------------------------------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(readxl) ## this library is part of the tidyverse
library(rgeos)
## Loading required package: sp
## rgeos version: 0.5-5, (SVN revision 640)
##  GEOS runtime version: 3.8.0-CAPI-1.13.1 
##  Linking to sp version: 1.4-2 
##  Polygon checking: TRUE
library(raster)
## 
## Attaching package: 'raster'
## The following object is masked from 'package:dplyr':
## 
##     select
## The following object is masked from 'package:tidyr':
## 
##     extract
library(sf)
## Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
library(cartography)
## Warning: package 'cartography' was built under R version 4.0.3
library(SpatialPosition)
## Warning: package 'SpatialPosition' was built under R version 4.0.3
getwd()
## [1] "C:/Users/JUAN PABLO/Downloads"

4. Lectura de los datos de NBI (Cundinamarca)

Por medio de la función “read_excel” se pueden leer los datos de NBI que se encuentran en formato xlsx

nbi <- read_excel("C:/Users/JUAN PABLO/Downloads/NBI_CUNDINAMARCA_2018.xlsx")
head(nbi)
## Warning: `...` is not empty.
## 
## We detected these problematic arguments:
## * `needs_dots`
## 
## These dots only exist to allow future extensions and should be empty.
## Did you misspecify an argument?
## # A tibble: 6 x 12
##   COD_DEPTO DEPTO COD_MUN CODIGO MUNICIPIO   NBI MISERIA VIVIENDA SERVICIOS
##   <chr>     <chr> <chr>   <chr>  <chr>     <dbl>   <dbl>    <dbl>     <dbl>
## 1 25        CUND~ 001     25001  AGUA DE ~  7.86   0.807    2.29      0.662
## 2 25        CUND~ 019     25019  ALBÁN      9.80   0.767    0.531     4.42 
## 3 25        CUND~ 035     25035  ANAPOIMA  10.4    0.711    1.55      0.936
## 4 25        CUND~ 040     25040  ANOLAIMA   9.78   1.08     1.18      0.738
## 5 25        CUND~ 053     25053  ARBELÁEZ  10.0    1.12     1.90      0.175
## 6 25        CUND~ 086     25086  BELTRÁN    9.66   1.13     5.35      1.13 
## # ... with 3 more variables: HACINAMIENTO <dbl>, INASISTENCIA <dbl>,
## #   ECONOMIA <dbl>

A partir del siguiente cuadro de código se puede identificar el municipio con mayor porcentaje de NBI.

nbi %>% 
    slice(which.max(NBI)) -> max_nbi

max_nbi
## Warning: `...` is not empty.
## 
## We detected these problematic arguments:
## * `needs_dots`
## 
## These dots only exist to allow future extensions and should be empty.
## Did you misspecify an argument?
## # A tibble: 1 x 12
##   COD_DEPTO DEPTO COD_MUN CODIGO MUNICIPIO   NBI MISERIA VIVIENDA SERVICIOS
##   <chr>     <chr> <chr>   <chr>  <chr>     <dbl>   <dbl>    <dbl>     <dbl>
## 1 25        CUND~ 885     25885  YACOPÍ     40.7    2.77     6.89      3.04
## # ... with 3 more variables: HACINAMIENTO <dbl>, INASISTENCIA <dbl>,
## #   ECONOMIA <dbl>

Yacopí presenta un alto índice de NBI de 40.65%, el cual puede explicarse por múltiples razones: Un factor fundamental es que el 77% de la población se encuentra en el área rural donde históricamente ha sido deficiente el acceso a servicios públicos a nivel nacional (Jaramillo et al., 2016).

Por otro lado, Yacopí presenta una tasa de dependencia económica 72.8%. Es decir, que por cada 100 personas en edad de trabajar hay aproximadamente 74 que dependen económicamente de ellos (Programa Desarrollo para la Paz del Magdalena centro).

Adicionalmente, la población enuncia que hay bajo estímulo económico ya que la viabilidad de la actividad ganadera, que es una de las más practicadas en la región, es muy baja principalmente por la falta de vías. Por lo tanto, existe una alta preocupación de una recaída en la implementación de cultivos ilícitos (Contexto ganadero, 2018)

Usando un cuadro de código muy similar al anterior, se obtiene el municipio con menor NBI para el año 2018

nbi %>% 
    slice(which.min(NBI)) -> min_nbi

min_nbi
## Warning: `...` is not empty.
## 
## We detected these problematic arguments:
## * `needs_dots`
## 
## These dots only exist to allow future extensions and should be empty.
## Did you misspecify an argument?
## # A tibble: 1 x 12
##   COD_DEPTO DEPTO COD_MUN CODIGO MUNICIPIO   NBI MISERIA VIVIENDA SERVICIOS
##   <chr>     <chr> <chr>   <chr>  <chr>     <dbl>   <dbl>    <dbl>     <dbl>
## 1 25        CUND~ 758     25758  SOPÓ       2.83  0.0874   0.0874    0.0932
## # ... with 3 more variables: HACINAMIENTO <dbl>, INASISTENCIA <dbl>,
## #   ECONOMIA <dbl>

Sopó es un municipio que gracias a sus actividades económicas como la agroindustria de producción de derivados lácteos y la producción de bienes para el sector constructor, ha podido proporcionar las mejores condiciones de vida a nivel Cundinamarca. Otra elemento relevante es que Sopó se encuentra cercano a la capital del país, contanto con vías de conexión en excelente estasdo, lo cual facilita la comercialización de sus productos (Alcaldía de Sopó, 2017)

Allí el 64% de la población habita en el casco urbano lo cual ha facilitado la provición de servicios públicos. Respecto a temas de salud se reporta una cobertura total de 71.1% y en educación básica un cubrimiento del 98% en la primaria con niveles de decersión menores al 5%. Por otro lado, (Camelo, 2018).

Este código permite organizar los municpios de acuerdo con su NBI en orden decendente. Se observa que los municpios con mayor pobreza son: Yacopí, Paime y La Peña.

nbi %>% 
  arrange(desc(NBI))  -> desc_nbi

desc_nbi
## Warning: `...` is not empty.
## 
## We detected these problematic arguments:
## * `needs_dots`
## 
## These dots only exist to allow future extensions and should be empty.
## Did you misspecify an argument?
## # A tibble: 116 x 12
##    COD_DEPTO DEPTO COD_MUN CODIGO MUNICIPIO   NBI MISERIA VIVIENDA SERVICIOS
##    <chr>     <chr> <chr>   <chr>  <chr>     <dbl>   <dbl>    <dbl>     <dbl>
##  1 25        CUND~ 885     25885  YACOPÍ     40.7   2.77      6.89    3.04  
##  2 25        CUND~ 518     25518  PAIME      34.7   2.91      8.73    3.33  
##  3 25        CUND~ 398     25398  LA PEÑA    29.9   3.83      6.99    5.19  
##  4 25        CUND~ 148     25148  CAPARRAPÍ  29.1   2.33      3.96    0.739 
##  5 25        CUND~ 823     25823  TOPAIPÍ    27.4   2.40      7.53    1.76  
##  6 25        CUND~ 258     25258  EL PEÑÓN   25.7   0.903     1.35    1.13  
##  7 25        CUND~ 862     25862  VERGARA    22.3   0.544     5.26    1.09  
##  8 25        CUND~ 839     25839  UBALÁ      21.3   3.70      2.92   27.1   
##  9 25        CUND~ 438     25438  MEDINA     20.6   0.393     1.96    0.0785
## 10 25        CUND~ 394     25394  LA PALMA   20.2   1.92      5.58    2.28  
## # ... with 106 more rows, and 3 more variables: HACINAMIENTO <dbl>,
## #   INASISTENCIA <dbl>, ECONOMIA <dbl>

5. Unión de los datos NBI con los municipios

Para poder realizar los mapas temáticos se requiere un contenido o capa base. Para este caso se subirá el shape file correspondiente a la división administrativa del departamento de Cundinamarca

munic <- st_read("C:/Users/JUAN PABLO/Documents/geo maps/25_CUNDINAMARCA/ADMINISTRATIVO/MGN_MPIO_POLITICO.shp")
## Reading layer `MGN_MPIO_POLITICO' from data source `C:\Users\JUAN PABLO\Documents\geo maps\25_CUNDINAMARCA\ADMINISTRATIVO\MGN_MPIO_POLITICO.shp' using driver `ESRI Shapefile'
## Simple feature collection with 116 features and 9 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -74.89063 ymin: 3.730129 xmax: -73.05256 ymax: 5.837258
## geographic CRS: WGS 84
munic
## Simple feature collection with 116 features and 9 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -74.89063 ymin: 3.730129 xmax: -73.05256 ymax: 5.837258
## geographic CRS: WGS 84
## First 10 features:
##    DPTO_CCDGO MPIO_CCDGO    MPIO_CNMBR                               MPIO_CRSLC
## 1          25      25483        NARIÑO                                     1899
## 2          25      25513         PACHO                                     1604
## 3          25      25506       VENECIA         Decreto 727 Septiembre 5 de 1951
## 4          25      25491       NOCAIMA                                     1735
## 5          25      25489       NIMAIMA            Ordenanza 30 de Julio de 1904
## 6          25      25488          NILO                                     1899
## 7          25      25486       NEMOCÓN                                     1778
## 8          25      25530   PARATEBUENO Ordenanza 36 del 30 de Noviembre de 1981
## 9          25      25535         PASCA                                     1887
## 10         25      25572 PUERTO SALGAR    Ordenanza 47 del 14 de Agosto de 1935
##    MPIO_NAREA MPIO_NANO   DPTO_CNMBR Shape_Leng  Shape_Area
## 1    55.16263      2017 CUNDINAMARCA  0.5219117 0.004493674
## 2   402.62678      2017 CUNDINAMARCA  1.2021630 0.032839624
## 3   122.20332      2017 CUNDINAMARCA  0.4873683 0.009951825
## 4    68.93823      2017 CUNDINAMARCA  0.3987992 0.005621814
## 5    59.49982      2017 CUNDINAMARCA  0.4990524 0.004852617
## 6   224.70968      2017 CUNDINAMARCA  0.8442993 0.018305852
## 7    98.36504      2017 CUNDINAMARCA  0.5509410 0.008022009
## 8   885.52351      2017 CUNDINAMARCA  1.7923439 0.072136135
## 9   271.71161      2017 CUNDINAMARCA  0.7143557 0.022134302
## 10  515.94145      2017 CUNDINAMARCA  1.3299992 0.042109370
##                          geometry
## 1  MULTIPOLYGON (((-74.7413 4....
## 2  MULTIPOLYGON (((-74.21183 5...
## 3  MULTIPOLYGON (((-74.44812 4...
## 4  MULTIPOLYGON (((-74.39011 5...
## 5  MULTIPOLYGON (((-74.34091 5...
## 6  MULTIPOLYGON (((-74.56068 4...
## 7  MULTIPOLYGON (((-73.88945 5...
## 8  MULTIPOLYGON (((-73.06503 4...
## 9  MULTIPOLYGON (((-74.24153 4...
## 10 MULTIPOLYGON (((-74.51278 5...

Como vamos a realizar un “join” se requiere que la variable de unión sea tipo factor

MPIO_CCDGO <- as.factor(munic$MPIO_CCDGO)

Por medio de este cuadro de código se realiza la unión de los dos archivos (las estadísticas NBI y el shapefile).

nbi$CODIGO<-as.factor(nbi$CODIGO)
nbi_munic = left_join(munic, nbi, by=c("MPIO_CCDGO"="CODIGO"))
nbi_munic
## Simple feature collection with 116 features and 20 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -74.89063 ymin: 3.730129 xmax: -73.05256 ymax: 5.837258
## geographic CRS: WGS 84
## First 10 features:
##    DPTO_CCDGO MPIO_CCDGO    MPIO_CNMBR                               MPIO_CRSLC
## 1          25      25483        NARIÑO                                     1899
## 2          25      25513         PACHO                                     1604
## 3          25      25506       VENECIA         Decreto 727 Septiembre 5 de 1951
## 4          25      25491       NOCAIMA                                     1735
## 5          25      25489       NIMAIMA            Ordenanza 30 de Julio de 1904
## 6          25      25488          NILO                                     1899
## 7          25      25486       NEMOCÓN                                     1778
## 8          25      25530   PARATEBUENO Ordenanza 36 del 30 de Noviembre de 1981
## 9          25      25535         PASCA                                     1887
## 10         25      25572 PUERTO SALGAR    Ordenanza 47 del 14 de Agosto de 1935
##    MPIO_NAREA MPIO_NANO   DPTO_CNMBR Shape_Leng  Shape_Area COD_DEPTO
## 1    55.16263      2017 CUNDINAMARCA  0.5219117 0.004493674        25
## 2   402.62678      2017 CUNDINAMARCA  1.2021630 0.032839624        25
## 3   122.20332      2017 CUNDINAMARCA  0.4873683 0.009951825        25
## 4    68.93823      2017 CUNDINAMARCA  0.3987992 0.005621814        25
## 5    59.49982      2017 CUNDINAMARCA  0.4990524 0.004852617        25
## 6   224.70968      2017 CUNDINAMARCA  0.8442993 0.018305852        25
## 7    98.36504      2017 CUNDINAMARCA  0.5509410 0.008022009        25
## 8   885.52351      2017 CUNDINAMARCA  1.7923439 0.072136135        25
## 9   271.71161      2017 CUNDINAMARCA  0.7143557 0.022134302        25
## 10  515.94145      2017 CUNDINAMARCA  1.3299992 0.042109370        25
##           DEPTO COD_MUN     MUNICIPIO       NBI   MISERIA   VIVIENDA  SERVICIOS
## 1  CUNDINAMARCA     483        NARIÑO  9.809524 1.6709512 1.92802057 0.32133676
## 2  CUNDINAMARCA     513         PACHO  7.984099 0.3615619 0.94006106 0.93202635
## 3  CUNDINAMARCA     506       VENECIA 13.102776 0.8865248 0.44326241 0.08865248
## 4  CUNDINAMARCA     491       NOCAIMA 10.666153 2.1058623 2.67501423 1.47979511
## 5  CUNDINAMARCA     489       NIMAIMA 12.847336 0.0000000 0.16233766 0.81168831
## 6  CUNDINAMARCA     488          NILO  7.916667 0.4062038 1.99409158 0.44313146
## 7  CUNDINAMARCA     486       NEMOCÓN  4.492540 0.0000000 0.07925186 0.01585037
## 8  CUNDINAMARCA     530   PARATEBUENO 15.398075 0.6483938 1.56203949 0.44208665
## 9  CUNDINAMARCA     535         PASCA  7.759613 1.1606819 1.19695321 1.08813928
## 10 CUNDINAMARCA     572 PUERTO SALGAR 13.477639 0.8277242 0.87320357 0.43660178
##    HACINAMIENTO INASISTENCIA ECONOMIA                       geometry
## 1     1.1568123    0.3213368 6.169666 MULTIPOLYGON (((-74.7413 4....
## 2     1.0605817    0.9641652 2.032782 MULTIPOLYGON (((-74.21183 5...
## 3     3.9893617    0.8865248 2.748227 MULTIPOLYGON (((-74.44812 4...
## 4     3.4149118    0.7968127 1.195219 MULTIPOLYGON (((-74.39011 5...
## 5     0.1623377    0.4870130 2.272727 MULTIPOLYGON (((-74.34091 5...
## 6     1.2186115    0.5908419 1.440177 MULTIPOLYGON (((-74.56068 4...
## 7     1.2204787    0.5706134 1.680139 MULTIPOLYGON (((-73.88945 5...
## 8     6.3660477    1.2083702 3.831418 MULTIPOLYGON (((-73.06503 4...
## 9     3.8810301    0.5077983 2.067465 MULTIPOLYGON (((-74.24153 4...
## 10    3.4291432    0.3911224 5.266509 MULTIPOLYGON (((-74.51278 5...
nbi_munic %>%
  dplyr::select(MUNICIPIO, MPIO_CCDGO, NBI)  ->  check_nbi_munic

head(check_nbi_munic)
## Simple feature collection with 6 features and 3 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -74.85582 ymin: 4.017652 xmax: -74.03929 ymax: 5.295559
## geographic CRS: WGS 84
##   MUNICIPIO MPIO_CCDGO       NBI                       geometry
## 1    NARIÑO      25483  9.809524 MULTIPOLYGON (((-74.7413 4....
## 2     PACHO      25513  7.984099 MULTIPOLYGON (((-74.21183 5...
## 3   VENECIA      25506 13.102776 MULTIPOLYGON (((-74.44812 4...
## 4   NOCAIMA      25491 10.666153 MULTIPOLYGON (((-74.39011 5...
## 5   NIMAIMA      25489 12.847336 MULTIPOLYGON (((-74.34091 5...
## 6      NILO      25488  7.916667 MULTIPOLYGON (((-74.56068 4...

Este cuadro de código permite hacer una reproyección de los municipios al sistema coordenado de referencia correspondiente a Magna Sirgas

nbi_munic_new <- st_transform(nbi_munic, crs = 3116)

6. Ejemplos de mapas temáticos

Para el desarrollo de estos mapas se hará uso del paquete “cartography”, el cual permite tener mapas de alta caldiad visual. Para el uso de esta librería se recomienda trabjar con archivos tip sf

6.1 Decarga de mosaicos de OpenStreetMap y Símbolos Proporcionales

Las funciones “getTiles” y “tilesLayer” permiten la descarga de mosaicos de OpenStreetMap. Por otro lado, propSymbolsLayer() genera símbolos como cuadrados o círculos, con áreas proporcionales asociados a una variable cuantitativa, que en este caso es NBI.

De este mapa se puede observar que los municipios con menores valores de NBI se encuentran aledaños a la capital, especialmente hacia la zona Norte. Esto sucede ya que Bogotá provee de empleo a muchos residentes de estos municipios en la zona empresarial del norte de la ciudad y a que hay vías de conexión que permiten comercialización de bienes o sirvicios. De este modo, municipios como Chía, Cajicá, Cota, La Calera, Tenjo y demás cuentan con los recursos necesarios para proveer mejores condiciones de vida a sus habitantes (Camelo, 2018)

# download osm tiles
mun.osm <- getTiles(
x = nbi_munic_new, 
type = "OpenStreetMap", 
zoom = 8,
cachedir = TRUE,
crop = FALSE
)
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0
## +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## datum WGS_1984 in CRS definition
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0
## +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## datum WGS_1984 in CRS definition
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0
## +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## datum WGS_1984 in CRS definition
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0
## +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## datum WGS_1984 in CRS definition
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0
## +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## datum WGS_1984 in CRS definition
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0
## +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## datum WGS_1984 in CRS definition
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0
## +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## datum WGS_1984 in CRS definition
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0
## +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## datum WGS_1984 in CRS definition
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0
## +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded
## datum WGS_1984 in CRS definition
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded datum Unknown based on GRS80 ellipsoid in CRS definition,
##  but +towgs84= values preserved
# set margins
opar <- par(mar = c(0,0,1.2,0))
# plot osm tiles
tilesLayer(x = mun.osm)
# plot municipalities (only borders are plotted)
plot(st_geometry(nbi_munic_new), col = NA, border = "black", add=TRUE)
# plot NBI
propSymbolsLayer(
  x = nbi_munic_new, 
  var = "NBI", 
  inches = 0.13, 
  col = "blue",
  legend.pos = "topright",  
  legend.title.txt = "Total NBI"
)
# layout
layoutLayer(title = " Distribución NBI en Cundinamarca",
            sources = "Fuente: DANE, 2018\n© OpenStreetMap",
            author = " Laura Juliana Peñuela Mojica ",
            frame = TRUE, north = FALSE, tabtitle = TRUE)
# north arrow
north(pos = "topleft")

6.2 Mapas cloropléticos

Este tipo de mapa muestra áreas sombredas de acuerdo con la variación de la variable en cuestión. En este caso se representa nuevamente los datos de NBI. Los municipios con en color vino más claros tienen menor valor de NBI y a medida que va oscureciendo aumenta dicho valor.

# set margins
opar <- par(mar = c(0,0,1.2,0))
# set figure background color
par(bg="grey90")
# plot municipalities (only the backgroung color is plotted)
plot(st_geometry(nbi_munic_new), col = NA, border = NA, bg = "#aadaff")
# plot NBI
choroLayer(
  x = nbi_munic_new, 
  var = "NBI",
  method = "geom",
  nclass=5,
  col = carto.pal(pal1 = "wine.pal", n1 = 5),
  border = "gray", 
  lwd = 0.5,
  legend.pos = "topright", 
  legend.title.txt = "NBI",
  add = TRUE
) 
# layout
layoutLayer(title = " Distribución de NBI en Cundinamarca",
            sources = "Fuente: DANE, 2018\n© OpenStreetMap",
            author = " Laura Juliana Peñuela Mojica ",
            frame = TRUE, north = TRUE, tabtitle = TRUE, col="black") 
# north arrow
north(pos = "topleft")

6.3 Mapas de símbolos proporcionales

Para realizar un mapa de este tipo se requiere usar la función propSymbolsTypoLayer(), la cual crea símbolos que son proporcionales a la variación de la primera variable y coloredos de un color particular para representar otra variable.

Iinicialmente, se debe crear una escala cualitativa que se realizará con la función “mutate”. La variable seleccionada fue pobreza y se definieron tres rangos: pobreza extrema, alta e intermedia.

Se observa que en el departamento no hay municipios con pobreza extrema y solo hay siete municipios con pobreza alta que corresponden a: Jerusalén, Quípile, Viotá, Pandi, Macheta, Chipaque Y Paratebueno.

nbi_munic_2 <- dplyr::mutate(nbi_munic_new, poverty = ifelse(MISERIA > 20, "Extreme", 
                                                         ifelse(HACINAMIENTO > 5, "High", "Intermediate")))
head(nbi_munic_2)
## Simple feature collection with 6 features and 21 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 913602.2 ymin: 936036.9 xmax: 1004237 ymax: 1077338
## projected CRS:  MAGNA-SIRGAS / Colombia Bogota zone
##   DPTO_CCDGO MPIO_CCDGO MPIO_CNMBR                       MPIO_CRSLC MPIO_NAREA
## 1         25      25483     NARIÑO                             1899   55.16263
## 2         25      25513      PACHO                             1604  402.62678
## 3         25      25506    VENECIA Decreto 727 Septiembre 5 de 1951  122.20332
## 4         25      25491    NOCAIMA                             1735   68.93823
## 5         25      25489    NIMAIMA    Ordenanza 30 de Julio de 1904   59.49982
## 6         25      25488       NILO                             1899  224.70968
##   MPIO_NANO   DPTO_CNMBR Shape_Leng  Shape_Area COD_DEPTO        DEPTO COD_MUN
## 1      2017 CUNDINAMARCA  0.5219117 0.004493674        25 CUNDINAMARCA     483
## 2      2017 CUNDINAMARCA  1.2021630 0.032839624        25 CUNDINAMARCA     513
## 3      2017 CUNDINAMARCA  0.4873683 0.009951825        25 CUNDINAMARCA     506
## 4      2017 CUNDINAMARCA  0.3987992 0.005621814        25 CUNDINAMARCA     491
## 5      2017 CUNDINAMARCA  0.4990524 0.004852617        25 CUNDINAMARCA     489
## 6      2017 CUNDINAMARCA  0.8442993 0.018305852        25 CUNDINAMARCA     488
##   MUNICIPIO       NBI   MISERIA  VIVIENDA  SERVICIOS HACINAMIENTO INASISTENCIA
## 1    NARIÑO  9.809524 1.6709512 1.9280206 0.32133676    1.1568123    0.3213368
## 2     PACHO  7.984099 0.3615619 0.9400611 0.93202635    1.0605817    0.9641652
## 3   VENECIA 13.102776 0.8865248 0.4432624 0.08865248    3.9893617    0.8865248
## 4   NOCAIMA 10.666153 2.1058623 2.6750142 1.47979511    3.4149118    0.7968127
## 5   NIMAIMA 12.847336 0.0000000 0.1623377 0.81168831    0.1623377    0.4870130
## 6      NILO  7.916667 0.4062038 1.9940916 0.44313146    1.2186115    0.5908419
##   ECONOMIA                       geometry      poverty
## 1 6.169666 MULTIPOLYGON (((926329 9864... Intermediate
## 2 2.032782 MULTIPOLYGON (((985111.1 10... Intermediate
## 3 2.748227 MULTIPOLYGON (((958849.2 94... Intermediate
## 4 1.195219 MULTIPOLYGON (((965338.7 10... Intermediate
## 5 2.272727 MULTIPOLYGON (((970798 1066... Intermediate
## 6 1.440177 MULTIPOLYGON (((946369 9754... Intermediate
library(sf)
library(cartography)
# set margins
opar <- par(mar = c(0,0,1.2,0))
# Plot the municipalities
plot(st_geometry(nbi_munic_2), col="#f2efe9", border="#b38e43", bg = "#aad3df", 
     lwd = 0.5)

# Plot symbols with choropleth coloration
propSymbolsTypoLayer(
  x = nbi_munic_2, 
  var = "NBI", 
  inches = 0.25,
  symbols = "square",
  border = "white",
  lwd = .5,
  legend.var.pos = c(1150000, 1100000), 
  legend.var.title.txt = "NBI",
  var2 = "poverty",
  legend.var2.values.order = c("High", "Intermediate"),
  col = carto.pal(pal1 = "multi.pal", n1 = 3),
  legend.var2.pos = c(1150000, 1000000), 
  legend.var2.title.txt = "poverty"
) 

# layout
layoutLayer(title="Distribución del NBI EN Cundinamarca", 
            author = "Laura Juliana Peñuela Mojica", 
            sources = "Fuente: DANE, 2018", 
            scale = 1, tabtitle = TRUE, frame = TRUE)
# north arrow
north(pos = "topleft")

6.4 Mapas de etiquetas

Para este mapa se requiere combinar las funciones “choroLayer” y “labellLayer”. Este es muy similar al mapa cloroplético del punto 6.2, no obstante, tiene las etiquetas correspondientes al nombre de los municipios

library(sf)
library(cartography)
# set margins
opar <- par(mar = c(0,0,1.2,0))
# set figure background color
par(bg="grey25")
# plot municipalities
plot(st_geometry(nbi_munic_2), col = "#e4e9de", border = "darkseagreen4", 
     bg = "grey75", lwd = 0.5)
# plot NBI
choroLayer(
  x = nbi_munic_new, 
  var = "NBI",
  method = "geom",
  nclass=5,
  col = carto.pal(pal1 = "pink.pal", n1 = 5),
  border = "white", 
  lwd = 0.5,
  legend.pos = "topright", 
  legend.title.txt = "NBI",
  add = TRUE
) 
# plot labels
labelLayer(
  x = nbi_munic_2, 
  txt = "MUNICIPIO", 
  col= "white", 
  cex = 0.4, 
  font = 4,
  halo = TRUE, 
  bg = "grey25", 
  r = 0.1, 
  overlap = FALSE, 
  show.lines = FALSE
)
# map layout
layoutLayer(title = " Distribución NBI en Cundinamarca",
            sources = "Sources: DANE, 2018\n© OpenStreetMap",
            author = " Laura Juliana Peñuela Mojica ",
  frame = TRUE,
  north = TRUE, 
  tabtitle = TRUE, 
  theme = "taupe.pal"
) 

6.5 Mapa de isopletas

Los mapas de isopletas parten del hecho de que la variable que se desea representar tiene una distribución continua. Estos permiten una representación espacial independiente de la heterogeneidad de acuerdo con la división territorial.

Para realizarlos se requiere de la función smoothLayer() la cual usa una capa de puntos marcados y un conjunto de parámetros (una función de interacción espacial y sus parámetros) y muestra una capa de mapa de isopletas.

En este caso el mapa se basará en las estadísticas para el año 2018 de uno de los cultivos más importantes de la región que es el de papa. Los datos fueron tomados del Geoportal del DANE de la base de datos “Evaluaciones Agropecuarias Municipales”.

Cundinamarca abarca el 37% del área sembrada en papa a nivel nacional y es el departamento con mayor rendimiento promedio (21,4 ton/ha) (MADR, 2019).

Cabe mencionar que en Colombia, la papa es el segundo producto de mayor importancia en la alimentación después del arroz (Redacción Economía, 2018)

crops2018 <- read_excel("C:/Users/JUAN PABLO/Documents/EVA_CUNDINAMARCA_PAPA_2018F.xlsx")
head(crops2018) 
## Warning: `...` is not empty.
## 
## We detected these problematic arguments:
## * `needs_dots`
## 
## These dots only exist to allow future extensions and should be empty.
## Did you misspecify an argument?
## # A tibble: 6 x 14
##   COD_DEPTO DEPTO COD_MUN MUN   GRUPO SUBGRUPO CULTIVO   ANO AREA_SEMBRADA
##       <dbl> <chr> <chr>   <chr> <chr> <chr>    <chr>   <dbl>         <dbl>
## 1        25 CUND~ 25019   ALBÁN TUBE~ PAPA     PAPA     2018             2
## 2        25 CUND~ 25099   BOJA~ TUBE~ PAPA     PAPA     2018           100
## 3        25 CUND~ 25120   CABR~ TUBE~ PAPA     PAPA     2018            85
## 4        25 CUND~ 25126   CAJI~ TUBE~ PAPA     PAPA     2018            10
## 5        25 CUND~ 25151   CÁQU~ TUBE~ PAPA     PAPA     2018            60
## 6        25 CUND~ 25154   CARM~ TUBE~ PAPA     PAPA     2018            50
## # ... with 5 more variables: AREA_COSECHADA <dbl>, PRODUCCION <dbl>,
## #   RENDIMIENTO <dbl>, ESTADO <chr>, CICLO <chr>
colnames(crops2018)
##  [1] "COD_DEPTO"      "DEPTO"          "COD_MUN"        "MUN"           
##  [5] "GRUPO"          "SUBGRUPO"       "CULTIVO"        "ANO"           
##  [9] "AREA_SEMBRADA"  "AREA_COSECHADA" "PRODUCCION"     "RENDIMIENTO"   
## [13] "ESTADO"         "CICLO"
names(crops2018)
##  [1] "COD_DEPTO"      "DEPTO"          "COD_MUN"        "MUN"           
##  [5] "GRUPO"          "SUBGRUPO"       "CULTIVO"        "ANO"           
##  [9] "AREA_SEMBRADA"  "AREA_COSECHADA" "PRODUCCION"     "RENDIMIENTO"   
## [13] "ESTADO"         "CICLO"
crops2018 %>%
  filter(CULTIVO == "PAPA", ANO == 2018) -> papa2018
head(papa2018)
## Warning: `...` is not empty.
## 
## We detected these problematic arguments:
## * `needs_dots`
## 
## These dots only exist to allow future extensions and should be empty.
## Did you misspecify an argument?
## # A tibble: 6 x 14
##   COD_DEPTO DEPTO COD_MUN MUN   GRUPO SUBGRUPO CULTIVO   ANO AREA_SEMBRADA
##       <dbl> <chr> <chr>   <chr> <chr> <chr>    <chr>   <dbl>         <dbl>
## 1        25 CUND~ 25019   ALBÁN TUBE~ PAPA     PAPA     2018             2
## 2        25 CUND~ 25099   BOJA~ TUBE~ PAPA     PAPA     2018           100
## 3        25 CUND~ 25120   CABR~ TUBE~ PAPA     PAPA     2018            85
## 4        25 CUND~ 25126   CAJI~ TUBE~ PAPA     PAPA     2018            10
## 5        25 CUND~ 25151   CÁQU~ TUBE~ PAPA     PAPA     2018            60
## 6        25 CUND~ 25154   CARM~ TUBE~ PAPA     PAPA     2018            50
## # ... with 5 more variables: AREA_COSECHADA <dbl>, PRODUCCION <dbl>,
## #   RENDIMIENTO <dbl>, ESTADO <chr>, CICLO <chr>
papa2018$TEMP<-as.character(papa2018$COD_MUN)
papa2018$MPIO_CCDGO<-as.factor(paste(papa2018$TEMP))
papa2018$MPIO_CCDGO <-  as.character(papa2018$COD_MUN)
head(papa2018)
## Warning: `...` is not empty.
## 
## We detected these problematic arguments:
## * `needs_dots`
## 
## These dots only exist to allow future extensions and should be empty.
## Did you misspecify an argument?
## # A tibble: 6 x 16
##   COD_DEPTO DEPTO COD_MUN MUN   GRUPO SUBGRUPO CULTIVO   ANO AREA_SEMBRADA
##       <dbl> <chr> <chr>   <chr> <chr> <chr>    <chr>   <dbl>         <dbl>
## 1        25 CUND~ 25019   ALBÁN TUBE~ PAPA     PAPA     2018             2
## 2        25 CUND~ 25099   BOJA~ TUBE~ PAPA     PAPA     2018           100
## 3        25 CUND~ 25120   CABR~ TUBE~ PAPA     PAPA     2018            85
## 4        25 CUND~ 25126   CAJI~ TUBE~ PAPA     PAPA     2018            10
## 5        25 CUND~ 25151   CÁQU~ TUBE~ PAPA     PAPA     2018            60
## 6        25 CUND~ 25154   CARM~ TUBE~ PAPA     PAPA     2018            50
## # ... with 7 more variables: AREA_COSECHADA <dbl>, PRODUCCION <dbl>,
## #   RENDIMIENTO <dbl>, ESTADO <chr>, CICLO <chr>, TEMP <chr>, MPIO_CCDGO <chr>
papa_munic = left_join(munic, papa2018, by="MPIO_CCDGO")
head(papa_munic)
## Simple feature collection with 6 features and 24 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -74.85582 ymin: 4.017652 xmax: -74.03929 ymax: 5.295559
## geographic CRS: WGS 84
##   DPTO_CCDGO MPIO_CCDGO MPIO_CNMBR                       MPIO_CRSLC MPIO_NAREA
## 1         25      25483     NARIÑO                             1899   55.16263
## 2         25      25513      PACHO                             1604  402.62678
## 3         25      25506    VENECIA Decreto 727 Septiembre 5 de 1951  122.20332
## 4         25      25491    NOCAIMA                             1735   68.93823
## 5         25      25489    NIMAIMA    Ordenanza 30 de Julio de 1904   59.49982
## 6         25      25488       NILO                             1899  224.70968
##   MPIO_NANO   DPTO_CNMBR Shape_Leng  Shape_Area COD_DEPTO        DEPTO COD_MUN
## 1      2017 CUNDINAMARCA  0.5219117 0.004493674        25 CUNDINAMARCA   25483
## 2      2017 CUNDINAMARCA  1.2021630 0.032839624        25 CUNDINAMARCA   25513
## 3      2017 CUNDINAMARCA  0.4873683 0.009951825        25 CUNDINAMARCA   25506
## 4      2017 CUNDINAMARCA  0.3987992 0.005621814        25 CUNDINAMARCA   25491
## 5      2017 CUNDINAMARCA  0.4990524 0.004852617        25 CUNDINAMARCA   25489
## 6      2017 CUNDINAMARCA  0.8442993 0.018305852        25 CUNDINAMARCA   25488
##       MUN                 GRUPO SUBGRUPO CULTIVO  ANO AREA_SEMBRADA
## 1  NARIÑO TUBERCULOS Y PLATANOS     <NA>    PAPA 2018             0
## 2   PACHO TUBERCULOS Y PLATANOS     PAPA    PAPA 2018            70
## 3 VENECIA TUBERCULOS Y PLATANOS     <NA>    PAPA 2018             0
## 4 NOCAIMA TUBERCULOS Y PLATANOS     <NA>    PAPA 2018             0
## 5 NIMAIMA TUBERCULOS Y PLATANOS     <NA>    PAPA 2018             0
## 6    NILO TUBERCULOS Y PLATANOS     <NA>    PAPA 2018             0
##   AREA_COSECHADA PRODUCCION RENDIMIENTO           ESTADO       CICLO  TEMP
## 1              0          0           0 TUBERCULO FRESCO TRANSITORIO 25483
## 2             70       1120          16 TUBERCULO FRESCO TRANSITORIO 25513
## 3              0          0           0 TUBERCULO FRESCO TRANSITORIO 25506
## 4              0          0           0 TUBERCULO FRESCO TRANSITORIO 25491
## 5              0          0           0 TUBERCULO FRESCO TRANSITORIO 25489
## 6              0          0           0 TUBERCULO FRESCO TRANSITORIO 25488
##                         geometry
## 1 MULTIPOLYGON (((-74.7413 4....
## 2 MULTIPOLYGON (((-74.21183 5...
## 3 MULTIPOLYGON (((-74.44812 4...
## 4 MULTIPOLYGON (((-74.39011 5...
## 5 MULTIPOLYGON (((-74.34091 5...
## 6 MULTIPOLYGON (((-74.56068 4...
rep_papa <- st_transform(papa_munic, crs = 3116)
head(rep_papa)
## Simple feature collection with 6 features and 24 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 913602.2 ymin: 936036.9 xmax: 1004237 ymax: 1077338
## projected CRS:  MAGNA-SIRGAS / Colombia Bogota zone
##   DPTO_CCDGO MPIO_CCDGO MPIO_CNMBR                       MPIO_CRSLC MPIO_NAREA
## 1         25      25483     NARIÑO                             1899   55.16263
## 2         25      25513      PACHO                             1604  402.62678
## 3         25      25506    VENECIA Decreto 727 Septiembre 5 de 1951  122.20332
## 4         25      25491    NOCAIMA                             1735   68.93823
## 5         25      25489    NIMAIMA    Ordenanza 30 de Julio de 1904   59.49982
## 6         25      25488       NILO                             1899  224.70968
##   MPIO_NANO   DPTO_CNMBR Shape_Leng  Shape_Area COD_DEPTO        DEPTO COD_MUN
## 1      2017 CUNDINAMARCA  0.5219117 0.004493674        25 CUNDINAMARCA   25483
## 2      2017 CUNDINAMARCA  1.2021630 0.032839624        25 CUNDINAMARCA   25513
## 3      2017 CUNDINAMARCA  0.4873683 0.009951825        25 CUNDINAMARCA   25506
## 4      2017 CUNDINAMARCA  0.3987992 0.005621814        25 CUNDINAMARCA   25491
## 5      2017 CUNDINAMARCA  0.4990524 0.004852617        25 CUNDINAMARCA   25489
## 6      2017 CUNDINAMARCA  0.8442993 0.018305852        25 CUNDINAMARCA   25488
##       MUN                 GRUPO SUBGRUPO CULTIVO  ANO AREA_SEMBRADA
## 1  NARIÑO TUBERCULOS Y PLATANOS     <NA>    PAPA 2018             0
## 2   PACHO TUBERCULOS Y PLATANOS     PAPA    PAPA 2018            70
## 3 VENECIA TUBERCULOS Y PLATANOS     <NA>    PAPA 2018             0
## 4 NOCAIMA TUBERCULOS Y PLATANOS     <NA>    PAPA 2018             0
## 5 NIMAIMA TUBERCULOS Y PLATANOS     <NA>    PAPA 2018             0
## 6    NILO TUBERCULOS Y PLATANOS     <NA>    PAPA 2018             0
##   AREA_COSECHADA PRODUCCION RENDIMIENTO           ESTADO       CICLO  TEMP
## 1              0          0           0 TUBERCULO FRESCO TRANSITORIO 25483
## 2             70       1120          16 TUBERCULO FRESCO TRANSITORIO 25513
## 3              0          0           0 TUBERCULO FRESCO TRANSITORIO 25506
## 4              0          0           0 TUBERCULO FRESCO TRANSITORIO 25491
## 5              0          0           0 TUBERCULO FRESCO TRANSITORIO 25489
## 6              0          0           0 TUBERCULO FRESCO TRANSITORIO 25488
##                         geometry
## 1 MULTIPOLYGON (((926329 9864...
## 2 MULTIPOLYGON (((985111.1 10...
## 3 MULTIPOLYGON (((958849.2 94...
## 4 MULTIPOLYGON (((965338.7 10...
## 5 MULTIPOLYGON (((970798 1066...
## 6 MULTIPOLYGON (((946369 9754...
# set margins
opar <- par(mar = c(0,0,1.2,0))
# plot municipalities (only the backgroung color is plotted)
plot(st_geometry(rep_papa), col = NA, border = "black", bg = "grey75")

# plot isopleth map
smoothLayer(
  x = rep_papa, 
  var = 'PRODUCCION',
  typefct = "exponential",
  span = 25000,
  beta = 2,
  nclass = 10,
  col = carto.pal(pal1 = 'green.pal', n1 = 10),
  border = "grey",
  lwd = 0.1, 
  mask = rep_papa, 
  legend.values.rnd = -3,
  legend.title.txt = "Production",
  legend.pos = "topright", 
  add=TRUE
)
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded datum Unknown based on GRS80 ellipsoid in CRS definition,
##  but +towgs84= values preserved
## Warning in showSRID(SRS_string, format = "PROJ", multiline = "NO"): Discarded
## datum Marco_Geocentrico_Nacional_de_Referencia in CRS definition
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded datum Unknown based on GRS80 ellipsoid in CRS definition,
##  but +towgs84= values preserved
## Warning in showSRID(SRS_string, format = "PROJ", multiline = "NO"): Discarded
## datum Marco_Geocentrico_Nacional_de_Referencia in CRS definition
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded datum Unknown based on GRS80 ellipsoid in CRS definition,
##  but +towgs84= values preserved
## Warning in showSRID(SRS_string, format = "PROJ", multiline = "NO"): Discarded
## datum Marco_Geocentrico_Nacional_de_Referencia in CRS definition
# annotation on the map
text(x = 650000, y = 1200000, cex = 0.6, adj = 0, font = 3,  labels = 
       "Distance function:\n- type = exponential\n- beta = 2\n- span = 20 km")
# layout
layoutLayer(title = "Distribución de la producción de papa en Cundinamarca",
            sources = "Fuentes: DANE and MADR, 2018",
            author = "Laura Peñuela",
            frame = FALSE, north = FALSE, tabtitle = TRUE, theme = "green.pal")
# north arrow
north(pos = "topleft")

7. Salvando mapas

En esta sección se realizarán dos mapas cloropleticos con símbolos proporcionales. El primero será en relación a producción y rendimiento y el segundo, rendimiento y área sembrada. Estos serán guardados en un archivo tipo .png.

Fácilmente se puede observar que Villapinzón presenta la mayor producción y a su vez la mayor área sembrada para el año 2018. No obstante, hay municipios que con menor producción tienen mayor rendimiento (Zipacón, Guatavia y Guasca).

Los altos valores en Villapinzón están dados, por un lado debido a las caracterísitcas agroclimáticas propicias para el cultivo . Y, por otro lado, gracias a los apoyos otorgados por el gobierno. Se reporta que entre el 2015 y el 2018 se realizó un aporte de 5.500 millones de pesos que favoreció a 6.500 familas cultivadoras de papa en este municipio (MADR, 2018)

### open the plot
png("C:/Users/JUAN PABLO/Documents/papa_2018.png", width = 2048, height = 1526)
# set margins
opar <- par(mar = c(0,0,5,5))
# Plot the municipalities
plot(st_geometry(rep_papa), col="darkseagreen3", border="darkseagreen4",  
     bg = "white", lwd = 0.6)
# Plot symbols with choropleth coloration
propSymbolsChoroLayer(x = rep_papa, var = "PRODUCCION", var2 = "RENDIMIENTO",
                      col = carto.pal(pal1 = "orange.pal", n1 = 3,
                                      pal2 = "sand.pal", n2 = 3),
                      inches = 0.8, method = "q6",
                      border = "grey50", lwd = 1,
                      legend.title.cex = 1.5,
                      legend.values.cex = 1.0,
                      legend.var.pos = "right", 
                      legend.var2.pos = "left",
                      legend.var2.values.rnd = 2,
                      legend.var2.title.txt = "Rendimiento\n(in Ton/Ha)",
                      legend.var.title.txt = "Produccion de papa en 2018",
                      legend.var.style = "e")
# plot labels
labelLayer(
  x = rep_papa, 
  txt = "MPIO_CNMBR", 
  col= "white", 
  cex = 1.0, 
  font = 4,
  halo = FALSE, 
  bg = "white", 
  r = 0.1, 
  overlap = FALSE, 
  show.lines = FALSE
)
# layout
layoutLayer(title="Producción y rendimeinto de papa en Cundinamarca, 2018",
            author = "Laura Peñuela", 
            sources = "Sources: MADR & DANE, 2018", 
            scale = 50, tabtitle = FALSE, frame = TRUE)
# north arrow
north(pos = "topleft")
#
title(main="Producción y rendimeinto de papa en Cundinamarca, 2018", cex.main=3,
      sub= "Fuentes: MADR & DANE, 2018", cex.sub=2)
#
graticule = TRUE
#
par(opar)
### close the plot
dev.off()
## png 
##   2
knitr::include_graphics("C:/Users/JUAN PABLO/Documents/papa_2018.png")

### open the plot
png("C:/Users/JUAN PABLO/Documents/papa_2018.png", width = 2048, height = 1526)
# set margins
opar <- par(mar = c(0,0,5,5))
# Plot the municipalities
plot(st_geometry(rep_papa), col="darkseagreen3", border="darkseagreen4",  
     bg = "white", lwd = 0.6)
# Plot symbols with choropleth coloration
propSymbolsChoroLayer(x = rep_papa, var = "AREA_SEMBRADA", var2 = "RENDIMIENTO",
                      col = carto.pal(pal1 = "green.pal", n1 = 3,
                                      pal2 = "sand.pal", n2 = 3),
                      inches = 0.8, method = "q6",
                      border = "grey50", lwd = 1,
                      legend.title.cex = 1.5,
                      legend.values.cex = 1.0,
                      legend.var.pos = "right", 
                      legend.var2.pos = "left",
                      legend.var2.values.rnd = 2,
                      legend.var2.title.txt = "Rendimiento\n(in Ton/Ha)",
                      legend.var.title.txt = "Área sembrada de papa en 2018",
                      legend.var.style = "e")
# plot labels
labelLayer(
  x = rep_papa, 
  txt = "MPIO_CNMBR", 
  col= "white", 
  cex = 1.0, 
  font = 4,
  halo = FALSE, 
  bg = "white", 
  r = 0.1, 
  overlap = FALSE, 
  show.lines = FALSE
)
# layout
layoutLayer(title="Produccion y rendimiento de papa en Cundinamarca, 2018",
            author = "Laura Peñuela", 
            sources = "Fuentes: MADR & DANE, 2018", 
            scale = 50, tabtitle = FALSE, frame = TRUE)
# north arrow
north(pos = "topleft")
#
title(main="Produccion y rendimiento de papa en Cundinamarca, 2018", cex.main=3,
      sub= "Fuentes: MADR & DANE, 2018", cex.sub=2)
#
graticule = TRUE
#
par(opar)
### close the plot
dev.off()
## png 
##   2
knitr::include_graphics("C:/Users/JUAN PABLO/Documents/papa_2018.png")

sessionInfo()
## R version 4.0.2 (2020-06-22)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 8.1 x64 (build 9600)
## 
## Matrix products: default
## 
## locale:
## [1] LC_COLLATE=Spanish_Colombia.1252  LC_CTYPE=Spanish_Colombia.1252   
## [3] LC_MONETARY=Spanish_Colombia.1252 LC_NUMERIC=C                     
## [5] LC_TIME=Spanish_Colombia.1252    
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] SpatialPosition_2.0.1 cartography_2.4.2     sf_0.9-6             
##  [4] raster_3.3-13         rgeos_0.5-5           sp_1.4-2             
##  [7] readxl_1.3.1          forcats_0.5.0         stringr_1.4.0        
## [10] dplyr_1.0.0           purrr_0.3.4           readr_1.3.1          
## [13] tidyr_1.1.0           tibble_3.0.2          ggplot2_3.3.2        
## [16] tidyverse_1.3.0      
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.5         lubridate_1.7.9    lattice_0.20-41    png_0.1-7         
##  [5] class_7.3-17       utf8_1.1.4         assertthat_0.2.1   digest_0.6.25     
##  [9] R6_2.4.1           cellranger_1.1.0   backports_1.1.7    reprex_0.3.0      
## [13] evaluate_0.14      e1071_1.7-3        httr_1.4.1         pillar_1.4.6      
## [17] rlang_0.4.6        rstudioapi_0.11    blob_1.2.1         rmarkdown_2.3     
## [21] rgdal_1.5-16       munsell_0.5.0      broom_0.7.0        compiler_4.0.2    
## [25] modelr_0.1.8       xfun_0.15          pkgconfig_2.0.3    htmltools_0.5.0   
## [29] tidyselect_1.1.0   codetools_0.2-16   fansi_0.4.1        crayon_1.3.4      
## [33] dbplyr_1.4.4       withr_2.2.0        grid_4.0.2         lwgeom_0.2-5      
## [37] jsonlite_1.7.0     gtable_0.3.0       lifecycle_0.2.0    DBI_1.1.0         
## [41] magrittr_1.5       units_0.6-7        scales_1.1.1       KernSmooth_2.23-17
## [45] cli_2.0.2          stringi_1.4.6      fs_1.4.2           xml2_1.3.2        
## [49] ellipsis_0.3.1     generics_0.0.2     vctrs_0.3.1        tools_4.0.2       
## [53] glue_1.4.1         hms_0.5.3          slippymath_0.3.1   yaml_2.2.1        
## [57] colorspace_1.4-1   isoband_0.2.2      classInt_0.4-3     rvest_0.3.5       
## [61] knitr_1.29         haven_2.3.1

Referencias

Alcaldía de Sopó. (2017). Nuestro municipio. Recuperado el 3 de Noviembre de 2020, de https://web.archive.org/web/20170628134015/http://www.sopo-cundinamarca.gov.co/informacion_general.shtml

Asociación Interacional de cartografía. Introducción a la cartografía temática [Archivo PDF]. Recuperado de http://redgeomatica.rediris.es/carto2/pdf/pdfT/tema1t.pdf

Camelo, J. (2018). Informe de Calidad de vida [Archivo PDF]. Bogotá: Universidad de La Sabana. Recuperada de https://www.unisabana.edu.co/fileadmin/Archivos_de_usuario/Documentos/Documentos_Empresa_y_Sociedad/La_Sabana_como_vamos/Informe_de_Calidad_de_Vida_2017-SCCV.pdf

Contexto Ganadero. (2018). Temor por regreso de cultivos ilegales a Yacopí. Recuperado el de 3 Noviembre 2020, de https://www.contextoganadero.com/regiones/temor-por-regreso-de-cultivos-ilegales-yacopi

Dávila, A. (2008). La cartografía temática [Archivo PDF]. Recuperado de http://www.geoportaligm.gob.ec/portal/wp-content/uploads/filebase/art%C3%ADculos_t%C3%A9cnicos/cartografia-tematica.pdf

Feres, J., Mancero, X. (2001). El método de las necesidas básicas insatifeschas (NBI) y sus aplicaciones en América Latina [Archivo PDF]. Santiago de Chile. Recuperado de https://repositorio.cepal.org/bitstream/handle/11362/4784/S0102117_es.pdf?sequence=1

MADR. (2019). Cadena de la papa. Indicadores e instrumentos [Archivo PDF]. Recuperado de https://sioc.minagricultura.gov.co/Papa/Documentos/2019-03-31%20Cifras%20Sectoriales.pdf

Programa Desarrollo para la Paz del Magdalena Centro. Yacopí, Cundinamarca. Recuperado el 3 de Noviembre de 2020, de https://pdpmagdalenacentro.org/pagina2017/sistema-de-informacion-irmac-yacopi/

Redacción Economía. (2018). La papa, el segundo alimento de los colombianos. Recuperado el 3 de noviembre de 2020, de https://www.elespectador.com/noticias/economia/la-papa-el-segundo-alimento-de-los-colombianos/