kadyb / rgugik

Download datasets from Polish Head Office of Geodesy and Cartography
https://kadyb.github.io/rgugik/
Other
33 stars 4 forks source link

Change in the administrative division of Poland from January 1, 2024 #98

Closed wacekk closed 11 months ago

wacekk commented 11 months ago

From January 1, 2024, the administrative division of Poland has changed https://isap.sejm.gov.pl/isap.nsf/DocDetails.xsp?id=WDU20230001472 New cities have been created, so the TERYT codes of individual communes will change. The name of the Słupsk commune was also changed to Redzikowo. Please correct the relevant data in the package at any time.

The boundaries of some communes are also changing, but this requires data corrections by GUGiK.

Happy New Year to rgugik developers!

kadyb commented 11 months ago

Thank you! I updated the data with the communes in the dev version:

# install.packages("remotes")
remotes::install_github("kadyb/rgugik")
kadyb commented 11 months ago

For reference, I used this code:

## https://eteryt.stat.gov.pl/eTeryt/rejestr_teryt/udostepnianie_danych/baza_teryt/uzytkownicy_indywidualni/pobieranie/pliki_pelne.aspx?contrast=default

unzip("TERC_Urzedowy_2024-01-02.zip")
TERC = read.csv2("TERC_Urzedowy_2024-01-02.csv")
unique(TERC$NAZWA_DOD)

# select only communes
sel = c("gmina miejska", "gmina wiejska", "gmina miejsko-wiejska",
        "gmina miejska, miasto stołeczne")
TERC = TERC[TERC$NAZWA_DOD %in% sel, ]

# TERYT is encoded using 7 characters
TERC$WOJ = ifelse(nchar(TERC$WOJ) == 1, paste0("0", TERC$WOJ), TERC$WOJ)
TERC$POW = ifelse(nchar(TERC$POW) == 1, paste0("0", TERC$POW), TERC$POW)
TERC$GMI = ifelse(nchar(TERC$GMI) == 1, paste0("0", TERC$GMI), TERC$GMI)

TERYT = paste0(TERC$WOJ, TERC$POW, TERC$GMI, TERC$RODZ)

commune_names = data.frame(NAME = TERC$NAZWA, TERYT = TERYT)
save(commune_names, file = "commune_names.rda")