我試圖將加那利群島的幾何圖形移向半島,以便在更大的比例尺上看到西班牙地圖,以按省表示資訊。
我從這個 ESRI 位置的 shapefile 開始

uj5u.com熱心網友回復:
我已經設法從不同的來源解決了,
http://centrodedescargas.cnig.es/CentroDescargas/index.jsp
點擊鏈接:參考地理資訊 - 市、省和自治區的界限 - 下載:lineas_limite.zip。
未壓縮檔案夾中的路徑: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
代碼:
library(ggplot2)
library(sf)
library(rmapshaper)
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) #CRS Península, Baleares, Ceuta y Melilla
geoprocanariasco <- geoprocanarias %>%
st_transform(crs) %>% #We transform the geometries of the Canary Islands
st_geometry() #We extract the geometries.
geoprocanariasco <- geoprocanariasco c(5, 7) #Move Canarias
geoprocanarias <- geoprocanarias %>%
st_set_geometry(geoprocanariasco) %>% #We change the geometries of the Canary Islands.
st_set_crs(crs) # We will specify the CRS of the Península for the Islas Canarias again.
geoprovincias <- rbind(geopropenínsula, geoprocanarias) #Join
geoprovincias$CódigoProvincia <- substring(geoprovincias$NATCODE, 5, 6)
# We eliminate the territory not associated with any province.
geoprovincias <- geoprovincias[!geoprovincias$CódigoProvincia=="54",]
# We simplify the provincial boundaries and smooth the lines.
geosprovincias <- ms_simplify(geoprovincias, keep = 0.00050, weighting = 6)
mapapro <- geosprovincias %>%
ggplot()
geom_sf()
theme_void()
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/403655.html
標籤:
