Skip to content

Commit

Permalink
cut shape files
Browse files Browse the repository at this point in the history
  • Loading branch information
krauwe committed Mar 20, 2024
1 parent 6f67725 commit 50d9cb3
Show file tree
Hide file tree
Showing 29 changed files with 21 additions and 26 deletions.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
43 changes: 20 additions & 23 deletions vignettes/nuts.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ small <- small %>%
, geo == "DED3" ~ 66786 + 5574
))
shape_06_n3 <- read_sf("NUTS_RG_20M_2006_3857.shp/NUTS_RG_20M_2006_3857.shp") %>%
filter(LEVL_CODE == 3 & CNTR_CODE == "DE") %>%
shape_06_n3 <- read_sf("shapefiles/NUTS_RG_20M_2006_3857_DE.shp") %>%
filter(LEVL_CODE == 3) %>%
full_join( manure_indic , by = c("NUTS_ID" = "geo")) %>%
filter( str_detect( NUTS_ID , '^DED1|^DED3' ))
shape_06_n2 <- read_sf("NUTS_RG_20M_2006_3857.shp/NUTS_RG_20M_2006_3857.shp") %>%
filter(LEVL_CODE == 2 & CNTR_CODE == "DE") %>%
shape_06_n2 <- read_sf("shapefiles/NUTS_RG_20M_2006_3857_DE.shp") %>%
filter(LEVL_CODE == 2) %>%
full_join( manure_indic , by = c("NUTS_ID" = "geo")) %>%
filter( str_detect( NUTS_ID , '^DED1|^DED3' ))
Expand Down Expand Up @@ -328,8 +328,8 @@ pat_converted <- nuts_convert_version(

```{r, echo=FALSE,include=FALSE}
no_2006 <-
read_sf("NUTS_RG_20M_2016_3857.shp/NUTS_RG_20M_2016_3857.shp") %>%
filter(LEVL_CODE == 2 & CNTR_CODE == "NO") %>%
read_sf("shapefiles/NUTS_RG_20M_2016_3857_NO.shp") %>%
filter(LEVL_CODE == 2) %>%
full_join(pat_n2_mhab_12_no , by = c("NUTS_ID" = "geo"))
no_changes <- cross_walks %>%
Expand Down Expand Up @@ -362,8 +362,8 @@ gg_2006 = ggplot() +
facet_wrap( ~ "Original 2012 data\n\n(NUTS VERSION 2016)")
no_2021 <-
read_sf("NUTS_RG_20M_2021_3857.shp/NUTS_RG_20M_2021_3857.shp") %>%
filter(LEVL_CODE == 2 & CNTR_CODE == "NO") %>%
read_sf("shapefiles/NUTS_RG_20M_2021_3857_NO.shp") %>%
filter(LEVL_CODE == 2) %>%
full_join(pat_converted , by = c("NUTS_ID" = "to_code")) %>%
filter(NUTS_ID != "NO0B")
Expand Down Expand Up @@ -516,22 +516,19 @@ pat_level1 <- nuts_aggregate(

```{r, echo=FALSE, fig.cap="Aggregating patents from NUTS 3 to NUTS 2 and NUTS 1; Sources: [Shapefiles](https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts) and [data](https://ec.europa.eu/eurostat/databrowser/view/PAT_EP_RTOT/default/table?lang=en) are from EUROSTAT; Created using the [sf](https://r-spatial.github.io/sf/) package.", fig.alt = "Three maps of Sweden with patent applications at the NUTS 3 level and aggregated to NUTS level 2 and 1."}
eu_nuts3 <-
read_sf("NUTS_RG_20M_2016_3857.shp/NUTS_RG_20M_2016_3857.shp") %>%
read_sf("shapefiles/NUTS_RG_20M_2016_3857_SE.shp") %>%
filter(LEVL_CODE == 3) %>%
full_join(pat_n3_nr_12_se , by = c("NUTS_ID" = "geo")) %>%
filter(str_detect(NUTS_ID, "^SE"))
full_join(pat_n3_nr_12_se , by = c("NUTS_ID" = "geo"))
eu_nuts2 <-
read_sf("NUTS_RG_20M_2016_3857.shp/NUTS_RG_20M_2016_3857.shp") %>%
read_sf("shapefiles/NUTS_RG_20M_2016_3857_SE.shp") %>%
filter(LEVL_CODE == 2) %>%
full_join(pat_level2 , by = c("NUTS_ID" = "to_code")) %>%
filter(str_detect(NUTS_ID, "^SE"))
full_join(pat_level2 , by = c("NUTS_ID" = "to_code"))
eu_nuts1 <-
read_sf("NUTS_RG_20M_2016_3857.shp/NUTS_RG_20M_2016_3857.shp") %>%
read_sf("shapefiles/NUTS_RG_20M_2016_3857_SE.shp") %>%
filter(LEVL_CODE == 1) %>%
full_join(pat_level1 , by = c("NUTS_ID" = "to_code")) %>%
filter(str_detect(NUTS_ID, "^SE"))
full_join(pat_level1 , by = c("NUTS_ID" = "to_code"))
gg_nuts3 = ggplot() +
geom_sf(
Expand Down Expand Up @@ -714,12 +711,12 @@ This section describes the spatial interpolation procedure. We first cover the l
Below, Norwegian NUTS-2 regions for the versions 2016 and 2021 are shown. All regions apart from Norway's most Northern region have been reorganized in this period.

```{r, echo=FALSE, message = FALSE, warning = FALSE, fig.cap="Norwegian NUTS-2 regions with boundary changes; Sources: [Shapefiles](https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts) from EUROSTAT; Created using the [sf](https://r-spatial.github.io/sf/) package.", fig.alt ="Two maps of Norwegian NUTS-2 regions in version 2016 and 2021. The most Eastern and Southern regions have been affected most by administrative redistricting."}
no_2016 <- read_sf("NUTS_RG_20M_2016_3857.shp/NUTS_RG_20M_2016_3857.shp") %>%
filter(grepl("^NO", NUTS_ID), nchar(NUTS_ID) == 4) %>%
no_2016 <- read_sf("shapefiles/NUTS_RG_20M_2016_3857_NO.shp") %>%
filter(nchar(NUTS_ID) == 4) %>%
mutate(nuts = paste0(NUTS_ID, "\n", NUTS_NAME))
no_2021 <- read_sf("NUTS_RG_20M_2021_3857.shp/NUTS_RG_20M_2021_3857.shp") %>%
filter(grepl("^NO", NUTS_ID), nchar(NUTS_ID) == 4, NUTS_ID != "NO0B") %>%
no_2021 <- read_sf("shapefiles/NUTS_RG_20M_2021_3857_NO.shp") %>%
filter(nchar(NUTS_ID) == 4, NUTS_ID != "NO0B") %>%
mutate(nuts = paste0(NUTS_ID, "\n", NUTS_NAME))
no_codes <- unique(c(no_2016$NUTS_ID, no_2021$NUTS_ID))
Expand Down Expand Up @@ -797,10 +794,10 @@ In addition to tracing the evolution of NUTS codes, the table contains **flows**

```{r, echo=FALSE, message = FALSE, warning = FALSE, fig.cap= "Alluvial plot illustrating area size flows; Created using the [ggalluvial](https://corybrunson.github.io/ggalluvial/) package.", fig.alt ="The alluvial plot shows population flows from NUTS version 2016 to 2021."}
# Add names
no_2016_names <- read_sf("NUTS_RG_20M_2016_3857.shp/NUTS_RG_20M_2016_3857.shp") %>%
no_2016_names <- read_sf("shapefiles/NUTS_RG_20M_2016_3857_NO.shp") %>%
select(from_code = NUTS_ID, from_name = NUTS_NAME) %>%
st_set_geometry(NULL)
no_2021_names <- read_sf("NUTS_RG_20M_2021_3857.shp/NUTS_RG_20M_2021_3857.shp") %>%
no_2021_names <- read_sf("shapefiles/NUTS_RG_20M_2021_3857_NO.shp") %>%
select(to_code = NUTS_ID, to_name = NUTS_NAME) %>%
st_set_geometry(NULL)
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added vignettes/shapefiles/NUTS_RG_20M_2006_3857_DE.shx
Binary file not shown.
Binary file added vignettes/shapefiles/NUTS_RG_20M_2016_3857_NO.dbf
Binary file not shown.
Binary file added vignettes/shapefiles/NUTS_RG_20M_2016_3857_NO.shp
Binary file not shown.
Binary file added vignettes/shapefiles/NUTS_RG_20M_2016_3857_NO.shx
Binary file not shown.
Binary file added vignettes/shapefiles/NUTS_RG_20M_2016_3857_SE.dbf
Binary file not shown.
Binary file added vignettes/shapefiles/NUTS_RG_20M_2016_3857_SE.shp
Binary file not shown.
Binary file added vignettes/shapefiles/NUTS_RG_20M_2016_3857_SE.shx
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions vignettes/shapefiles/NUTS_RG_20M_2021_3857_NO.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]
Binary file added vignettes/shapefiles/NUTS_RG_20M_2021_3857_NO.shp
Binary file not shown.
Binary file added vignettes/shapefiles/NUTS_RG_20M_2021_3857_NO.shx
Binary file not shown.

0 comments on commit 50d9cb3

Please sign in to comment.