1. ¿QUÉ ES?

A diferencia de la cartografía base, la cartografía temática se centra en le representación de un tema o fenómeno en concreto, el cual puede ser una variable de cualquier índole. Este tipo de cartografía excluye los temas puramente topográficos, que constituyen la cartografía base. Sin embargo, esto no significa que sean excluyentes entre sí, ya que la cartografía temática se apoya en la cartografía base, puesto que esta facilita la comprensión del comportamiento espacial de la variable arepresentar y contribuye a ubicar la variable en un contexto geográfico (Olaya, 2014). Por lo tanto, los mapas temáticas revelan patrones espaciales que los propios datos ocultan.

Por lo tanto, los mapas temáticos están compuestos por dos elementos, una base geográfica o mapa base, y una capa de contenido específico o temático. Estos dos componentes están dispuestos de manera que el usuario es capaz de integrarlos visual y mentalmente durante la lectura del mapa. Así pues, el mapa base proporciona información espacial sobre la que referenciar el contenido del tema, por lo que debe estar correctamente diseñado e incluir únicamente la cantidad de información necesaria. En cuanto al contenido temático, es importante la simplicidad y legibilidad del mismo (Rodriguez, 2019).

Por último, los mapas temáticos representan la mayor parte de los mapas creados en un SIG, por lo que resulta importante ver en detalle las formas en las que pueden presentarse:

Cloroplético:

Los mapas de coropletas contienen áreas que están sombreadas o con patrones en proporción a la variable estadística de interés. Los datos se agregaron sobre unidades de área predefinidas. Debe haber un número de categorías limitado. Se usa cuando los datos están estandarizados, son discretos y se distribuyen dentro de unidades de área bien definidas (CDC, 2017).

Isoplético:

Es un mapa de curvas de nivel que muestra información fluida y continua (datos de contaminación o metereológicos). Los datos se representan mediante líneas que conectan puntos de igual valor numérico. Son una representación útil para resaltar patrones especiales en los datos (CDC, 2017).

Dasimétrico:

Usa símbolos para clasificar espacialmente datos volumétricos, sirve como una alternativa a los datos cloropléticos. Es más apropiado usarlos cuando no están distribuidos uniformemente. Sirve para representar datos estandarizados (CDC, 2017).

2. DATOS DEPARTAMENTO DEL CESAR

Los datos utilizados corresponderán a las estadísticas de Necesidades Básicas Insatisfechas (NBI) del Censo Nacional de Población y Vivienda 2018, el cual está disponible en el Geoportal del DANE.

De acuerdo con el DANE, la metodología NBI buscar determinar, con ayuda de algunos indicadores simples, si las necesidades básicas de la población se encuentran cubiertas. Los grupos que no alcancen un umbral mínimo fijado, son clasificados como pobres. Los indicadores simples seleccionados, son: viviendas inadecuadas, viviendas con hacinamiento crítico, viviendas con servicios inadecuados, viviendas con alta dependencia económica, viviendas con niños en edad escolar que no asisten a la escuela.

Inicialmente, se debe descargar el documento NBO en formato .xlsx. Después se remueven los datos de los municipios que no son de interes, así como las columnas correspondientes a “cabecera” y “zona rural”.

3. PREPARACIÓN

Primero se debe limpiar la memoria y luego descargar y llamar las librerías necesarias.

rm(list = ls())
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.2     v purrr   0.3.4
## v tibble  3.0.3     v dplyr   1.0.2
## v tidyr   1.1.2     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)
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(sf)
## Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
library(raster)
## 
## Attaching package: 'raster'
## The following object is masked from 'package:dplyr':
## 
##     select
## The following object is masked from 'package:tidyr':
## 
##     extract
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

4. LEER DATOS NBI

Se debe empezar por subir el archivo descargado previamente en el numeral 2.

NBI_Ces <- read_excel("/Users/Marcela/Documents/UNAL/2020-2/GB/NBI.xlsx")

Observar los atributos de los datos

head(NBI_Ces)

Primero se debe encontrar cual es el municipio con el porcentaje de NBI más alto

Max_NBI <- NBI_Ces %>% slice(which.max(NBI))
Max_NBI

El resultado obtenido permite observar que el municipio Pueblo Bello tiene el NBI más alto con 64.5%. Lo anterior se debe a que en el municipio no se ofrecen servicios ni se satisfacen las necesidades básicas de sus pobladores, en el tema de agua potable y alcantarillado, gas domiciliario, así como electrificación rural. Sumado a esto, el actual alcalde afirma que Pueblo Bello se considera pobre, debido a que es un municipio nuevo, constituido hace 19 años, y, por lo tanto, hasta ahora se está trabajando en las necesidades de la población (El Pilón, 2017).

Ahora, de manera similar es posible encontrar el municipio con el porcentaje de NBI más bajo.

Min_NBI <- NBI_Ces %>% slice(which.min(NBI))
Min_NBI

El resultado anterior está en concordancia con lo reportado por El Pilón (2017), donde se menciona que el NBI de San Alberto es el más bajo del departamento por la manera en que sus habitantes acceden a los servicios con los que satisfacen sus necesidades de salud, educación, vivienda, trabajo, servicios públicos y los destinados a la juventud y la niñez; determinando así mejor calidad de vida. Además, según el actual mandatario esto se ha debido a la inversión en el sector social, como en infraestructura deportiva y educativa, cultura, recreación, deportes, salud y protección social. En general se puede observar que San Alberto ha hecho un buen trabajo en la lucha contra la pobreza, puesto que es el único municipio que tiene un índice de pobreza menor al nacional.

Para tener mejor visibilidad de los datos es posible organizarlos de forma descendente

Desc_NBI <- NBI_Ces %>% arrange(desc(NBI))
Desc_NBI

5. UNIENDO DATOS MUNICIPALES A NBI

Como siempre, se debe empezar por subir el documento, esta vez será el shapefile correspondiente a los municipios dentro de Cesar.

Munic <- st_read("/Users/Marcela/Documents/UNAL/2020-2/GB/Cesar/MGN_MPIO_POLITICO.shp")
## Reading layer `MGN_MPIO_POLITICO' from data source `C:\Users\Marcela\Documents\UNAL\2020-2\GB\Cesar\MGN_MPIO_POLITICO.shp' using driver `ESRI Shapefile'
## Simple feature collection with 25 features and 9 fields
## geometry type:  POLYGON
## dimension:      XY
## bbox:           xmin: -74.13916 ymin: 7.67435 xmax: -72.88575 ymax: 10.86767
## geographic CRS: WGS 84
Munic
MPIO_CCDGO <- as.factor(Munic$MPIO_CCDGO)
NBI_Ces$CODIGO <- as.factor(NBI_Ces$CODIGO)
NBI_Munic <- left_join(Munic, NBI_Ces, by=c("MPIO_CCDGO"="CODIGO"))
NBI_Munic
NBI_Munic %>%
  dplyr::select(MUNICIPIO, MPIO_CCDGO, NBI)  ->  Check_nbi_munic

Check_nbi_munic

Ahora se procede a reproyectar los municipios

NBI_Munic_New <- st_transform(NBI_Munic, crs = 3116)

6. EJEMPLOS DE MAPAS TEMÁTICOS

Se usará el paquete cartography con el objetivo de obtener mapas temáticos que tengan la misma calidad visual que aquellos creados con un software GIS. Este paquete usas objetos sf o sp para producir gráficos básicos.

6.1 OpenStreetMap Basemap y Símbolos Proporcionales

La función getTiles ayuda a crear mapas de la base de mapas OpenStreetMap, luego se establecen los parámetros del gráfico y las etiquetas para visualizar la variable NBI con círculos de diferentes tamaños, creando así un mapa proporcional o de símbolos graduados.

Mun_osm <- getTiles(
x = NBI_Munic_New, 
type = "OpenStreetMap", 
zoom = 10,
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
## 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
## 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
## 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
## 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

## 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.15, 
  col = "pink",
  legend.pos = "topright",  
  legend.title.txt = "Total NBI",
  legend.frame = T,
  legend.style = "e"
)
# layout
layoutLayer(title = "Distribución de NBI en Cesar",
            sources = "Fuente: DANE, 2018\n© OpenStreetMap",
            author = "Laura Hernández",
            frame = TRUE, north = FALSE, tabtitle = TRUE)
# north arrow
north(pos = "topleft")

El mapa anterior permite visualizar el comportamiento de la variable NBI a lo largo del departamento mediante círculos de diferentes tamaños, por lo tanto, círculos más grandes indican que el municipio tiene un mayor índice de NBI.

6.2 Mapas Cloropléticos

Como se mencionó previamente, en los mapas cloropléticos las áreas están coloreadas de acuerdo con la variación de una variable cuantitativa. Para crear mapas cloropléticos se usará la función choroLayer(), mientras que la función getBreaks() permite clasificar fuera de la función en sí. Además, las paletas de colores se definen con col y se puede crear un conjunto de colores con carto.pal().

library(sf)
library(cartography)
# 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 = "sand.pal", n1 = 5),
  border = "white", 
  lwd = 0.9,
  legend.pos = "topright", 
  legend.title.txt = "NBI",
  add = TRUE
) 
# layout
layoutLayer(title = "Distribución de NBI en Cesar", 
            sources = "Fuente: DANE, 2018",
            author = "Laura Hernandez", 
            frame = TRUE, north = TRUE, tabtitle = TRUE, col="black") 
# north arrow
north(pos = "topleft")

El mapa anterior representa la distribución de NBI mediante diferentes valores de color, de modo que, tonalidades más oscuras simbolizan un mayor índice. Por lo tanto, el municipio con el tono más oscuro es Pueblo Bello, debido a las razones que ya se mencionaron, mientras que el municipio con el tono más claro ubicado en la parte inferior del mapa es San Alberto, lo cual también puede deberse a que en este municipio se encuentra la mayor área cosechada de palma de aceite, lo que contribuye a mejorar la economía del municipio.

6.3 Símbolos Proporcionales y Mapas Tipológicos

La función propSymbolsTypoLayer() crea mapas de símbolos que son proporcionales a los variables de la primera variable y el color refleja la modamilidad de la segunda variable cualitativa.

Primero se debe crear una variable cualitativa y se usa la función mutate para realizar esta tarea.

NBI_munic_2 <- dplyr::mutate(NBI_Munic_New, pobreza = ifelse(MISERIA > 20, "Extreme", 
                                                         ifelse(HACINAMIENTO > 5, "High", "Intermediate")))

Del código anterior se puede visualizar que el nuevo atributo se llama pobreza. Su valor depende de los valores del umbral definidos por el usuario.

head(NBI_munic_2)
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.3,
  symbols = "square",
  border = "white",
  lwd = .9,
  legend.var.pos = c(1050000, 1350000), 
  legend.var.title.txt = "NBI",
  var2 = "pobreza",
  legend.var2.values.order = c("Extreme", "High", "Intermediate"),                  col = carto.pal(pal1 = "multi.pal", n1 = 3),
  legend.var2.pos = c(1400000, 980000), 
  legend.var2.title.txt = "Pobreza"
) 
# layout
layoutLayer(title="Distribución del NBI en Cesar", 
            author = "Laura Hernández", 
            sources = "Fuente: DANE, 2018", 
            scale = 1, tabtitle = TRUE, frame = TRUE)
# north arrow
north(pos = "topleft")

El mapa anterior permite combina la forma y el valor de los colores, sin embargo, esta representación tan sencilla de analizar ni visualmente atractiva,

6.4 Mapas de etiquetas

Se combinarán las funciones choroLayer y labelLayer

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 = "orange.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 = "Municipios de Cesar", 
  sources = "Fuente: DANE, 2018",  
  author = "Laura Hernández", 
  frame = TRUE,
  north = TRUE, 
  tabtitle = TRUE, 
  theme = "taupe.pal"
) 

El mapa anterior presenta la información de forma más clara debido a que muestra los nombres de los municipios, confirmando una vez más lo mencionado anteriormente. Además, también permite visualizar que municipios como Astrea y Becerril tienen un NBI de 47, mientras que la capital, Valledupar tiene un índice de 18 aproximadamente. Este mapa resultaría de gran ayuda al momento de realizar planes de ordenamiento territorial en el municipio, debido a que permite analizar rápidamente en qué municipios están las personas con condiciones más vunerables.

6.5 Mapas de Isopletas

Los mapas de isopletas representan fenómenos de distribución continua. Permiten una representación espacial del fenómeno independiente de la heterogeneidad inicial de la división territorial. Para realizar un mapa de este tipo primero se debe cargar la información relacionada con producción de cultivos, utilizada en el primer reporte.

Cultivos2018 <- read.csv("Cesar_EVA.csv", sep = ";")
head(Cultivos2018)
colnames(Cultivos2018)
##  [1] "CÓD."                                         
##  [2] "DEPARTAMENTO"                                 
##  [3] "COD_MUN"                                      
##  [4] "MUNICIPIO"                                    
##  [5] "GRUPO..DE.CULTIVO"                            
##  [6] "SUBGRUPO..DE.CULTIVO"                         
##  [7] "CULTIVO"                                      
##  [8] "DESAGREGACIÓN.REGIONAL.Y.O.SISTEMA.PRODUCTIVO"
##  [9] "AÑO"                                          
## [10] "Área.Sembrada..ha."                           
## [11] "Área.Cosechada..ha."                          
## [12] "Producción..t."                               
## [13] "Rendimiento..t.ha."                           
## [14] "ESTADO.FISICO.PRODUCCION"                     
## [15] "NOMBRE..CIENTIFICO"                           
## [16] "CICLO.DE.CULTIVO"
names(Cultivos2018) <-c("COD", "DEPARTAMENTO", "COD_MUN", "MUNICIPIO", 
                 "GRUPO", "SUBGRUPO", "CULTIVO", "S. PRODUCTIVO",
                 "YEAR", "AREA_SEM", "AREA_COSE",
                 "PRODUCCION", "RENDIMIENTO", "ESTADO", "NOMBRE",
                 "CICLO" )
colnames(Cultivos2018)
##  [1] "COD"           "DEPARTAMENTO"  "COD_MUN"       "MUNICIPIO"    
##  [5] "GRUPO"         "SUBGRUPO"      "CULTIVO"       "S. PRODUCTIVO"
##  [9] "YEAR"          "AREA_SEM"      "AREA_COSE"     "PRODUCCION"   
## [13] "RENDIMIENTO"   "ESTADO"        "NOMBRE"        "CICLO"

Se procede a filtrar los datos para obtener solo los de producción de palma de aceite en el 2018.

Cultivos2018 %>%
  filter(CULTIVO == "PALMA DE ACEITE", YEAR == 2018) -> Palma2018

Palma2018

Ahora se crea un nuevo atributo que coincida con los códigos de los municipios

Palma2018$MPIO_CCDGO <- as.character(Palma2018$COD_MUN)

Nuevamente se usará la función left_join, lo cual es posible debido a que las variables COD_MUN y MPIO_CCDGO tienen los mismos valores.

Palma_Munic = left_join(Munic, Palma2018, by= "MPIO_CCDGO")
head(Palma_Munic)

De nuevo se reproyectan los municipios

Rep_Palma <- st_transform(Palma_Munic, crs=3116)
head(Rep_Palma)
# set margins
opar <- par(mar = c(0,0,1.2,0))
# plot municipalities (only the backgroung color is plotted)
plot(st_geometry(Rep_Palma), col = NA, border = "black", bg = "white")
# plot isopleth map
smoothLayer(
  x = Rep_Palma, 
  var = 'PRODUCCION',
  typefct = "exponential",
  span = 25000,
  beta = 2,
  nclass = 10,
  col = carto.pal(pal1 = 'orange.pal', n1 = 10),
  border = "black",
  lwd = 0.1, 
  mask = Rep_Palma, 
  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(uprojargs, format = "PROJ", multiline = "NO"): Discarded datum Unknown based on GRS80 ellipsoid in CRS definition,
##  but +towgs84= values preserved

## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded datum Unknown based on GRS80 ellipsoid in CRS definition,
##  but +towgs84= values preserved
# 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 = "Producción de Palma de Aceite en Cesar",
            sources = "Fuente: DANE and MADR, 2018",
            author = "Laura Hernández",
            frame = FALSE, north = FALSE, tabtitle = TRUE, theme = "orange.pal")
# north arrow
north(pos = "topleft")

Este mapa de isopletas nos permite ver la distribución de la producción de palma de aceite en el departamento de Cesar, observando una tendencia de mayor producción en las zonas centrales y menor producción en las zonas fronterizas.

7. GUARDAR MAPAS

A continuación se realizará otro mapa de producción de Palma de Aceite usando símbolos proporcionales y mapas cloropléticos. El mapa resultante se guardará como formato .png

Para esto hay que tener en cuenta que la función propSymbolsChoroLayer() crea mapas de símbolos que son proporcionales a los valores de la primera variable y el color refleja la clasificación de la segunda variable, por lo tanto, se usará una combinación de propSymbolsLayer() y choroLayer().

### open the plot
png("/Users/Marcela/Documents/UNAL/2020-2/GB/palma.png", width = 2048, height = 1526)
# set margins
opar <- par(mar = c(0,0,5,5))
# Plot the municipalities
plot(st_geometry(Rep_Palma), col="darkseagreen3", border="black",  
     bg = "white", lwd = 0.6)
# Plot symbols with choropleth coloration
propSymbolsChoroLayer(x = Rep_Palma, var = "PRODUCCION", var2 = "RENDIMIENTO",
                      col = carto.pal(pal1 = "green.pal", n1 = 3,
                                      pal2 = "red.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 = "Producción de Palma de Aceite en 2018",
                      legend.var.style = "e")
# plot labels
labelLayer(
  x = Rep_Palma, 
  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 Rendimiento de Palma de Aceite en 2018",
            author = "Laura Hernández", 
            sources = "Fuente: MADR & DANE, 2018", 
            scale = 50, tabtitle = FALSE, frame = TRUE)
# north arrow
north(pos = "topleft")
#
title(main="Producción y Rendimiento de Palma de Aceite, 2018", cex.main=3,
      sub= "Fuente: MADR & DANE, 2018", cex.sub=2)
#
graticule = TRUE
#
par(opar)
### close the plot
dev.off()
## png 
##   2

El resultado es el siguiente:

knitr::include_graphics("/Users/Marcela/Documents/UNAL/2020-2/GB/Palma.PNG")

8. BIBLIOGRAFÍA

CDC.2017. Thypes of Thematic Maps. Diponible en CDC

El Pilón. 2017. San Alberto, el municipio con menos pobreza. Disponible El Pilón

Olaya, V. 2014. Sistemas de Información Geográfica. Disponible en Volaya

Rodríguez, L. 2019. Capítulo 1. Introducción a la Cartografía Temática. Disponible en Red Geomática