library(leaflet)
library(sf)
## Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1
library(rgdal)
## Loading required package: sp
## Please note that rgdal will be retired by the end of 2023,
## plan transition to sf/stars/terra functions using GDAL and PROJ
## at your earliest convenience.
##
## rgdal: version: 1.5-27, (SVN revision 1148)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 3.2.1, released 2020/12/29
## Path to GDAL shared files: C:/Users/ADMIN/Documentos/R/win-library/4.0/rgdal/gdal
## GDAL binary built with GEOS: TRUE
## Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]
## Path to PROJ shared files: C:/Users/ADMIN/Documentos/R/win-library/4.0/rgdal/proj
## PROJ CDN enabled: FALSE
## Linking to sp version:1.4-5
## To mute warnings of possible GDAL/OSR exportToProj4() degradation,
## use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
## Overwritten PROJ_LIB was C:/Users/ADMIN/Documentos/R/win-library/4.0/rgdal/proj
library(mapview)
amz = readOGR('../amazonas/91_AMAZONAS/ADMINISTRATIVO/MGN_MPIO_POLITICO.shp')
## OGR data source with driver: ESRI Shapefile
## Source: "C:\Users\ADMIN\Documentos\CARLOS\UNAL\Asignaturas\Geomatica\amazonas\91_AMAZONAS\ADMINISTRATIVO\MGN_MPIO_POLITICO.shp", layer: "MGN_MPIO_POLITICO"
## with 11 features
## It has 9 fields
amz2 = st_read('../amazonas/91_AMAZONAS/ADMINISTRATIVO/MGN_MPIO_POLITICO.shp')
## Reading layer `MGN_MPIO_POLITICO' from data source
## `C:\Users\ADMIN\Documentos\CARLOS\UNAL\Asignaturas\Geomatica\amazonas\91_AMAZONAS\ADMINISTRATIVO\MGN_MPIO_POLITICO.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 11 features and 9 fields
## Geometry type: POLYGON
## Dimension: XY
## Bounding box: xmin: -74.39634 ymin: -4.229406 xmax: -69.3955 ymax: 0.09725686
## Geodetic CRS: WGS 84
plot(amz)
CRS
amz@proj4string
## CRS arguments: +proj=longlat +datum=WGS84 +no_defs
m <- leaflet(amz)
m %>%
addPolygons()
bins <- c(0, ceiling(quantile(amz$MPIO_NAREA)))
pal <- colorBin("YlOrRd", domain = amz$MPIO_NAREA, bins = bins)
m %>%
addTiles() %>%
addPolygons(
fillColor = ~pal(MPIO_NAREA),
weight = 2,
opacity = 1,
color = 'white',
dashArray = '3',
fillOpacity = 0.7
) %>%
addLegend(pal = pal, values = ~MPIO_NAREA, opacity = 0.7, title = NULL,
position = "bottomright")
Encoding(amz$MPIO_CNMBR) <- "UTF-8"
mapview(amz, zcol='MPIO_CNMBR')
Geoportal DANE
folder