I have tried to move the geometries of the Canary Islands towards the peninsula so that the map of Spain is seen on a larger scale to represent information by provinces.
I have started from the shapefile of this ESRI location
CodePudding user response:
I have managed to solve from a different source,
http://centrodedescargas.cnig.es/CentroDescargas/index.jsp
Following the links: Reference geographic information - Municipal, provincial and autonomous limits - Download: lineas_limite.zip.
The path in the uncompressed folder: SIGLIM_Publico_INSPIRE:
- SHP_ETRS89 - recintos_provinciales_inspire_peninbal_etrs89 - recintos_provinciales_inspire_peninbal_etrs89.shp
- SHP_WGS84 - recintos_provinciales_inspire_canarias_wgs84 - recintos_provinciales_inspire_canarias_wgs84.shp
The code:
geopropenínsula <- st_read("ruta/recintos_provinciales_inspire_peninbal_etrs89.shp")
geoprocanarias <- st_read("ruta/recintos_provinciales_inspire_canarias_wgs84.shp")
crs <- st_crs(geopropenínsula)
geoprocanariasco <- geoprocanarias %>%
st_transform(crs) %>%
st_geometry()
geoprocanariasco <- geoprocanariasco c(5, 7)
geoprocanarias <- geoprocanarias %>%
st_set_geometry(geoprocanariasco) %>%
st_set_crs(crs)
geoprovincias <- rbind(geopropenínsula, geoprocanarias)
geoprovincias$CódigoProvincia <- substring(geoprovincias$NATCODE, 5, 6)
geoprovincias <- geoprovincias[!geoprovincias$CódigoProvincia=="54",]
geosprovincias <- ms_simplify(geoprovincias, keep = 0.00050, weighting = 6)
mapapro <- geosprovincias %>%
ggplot()
geom_sf()
theme_void()

