diff --git a/DESCRIPTION b/DESCRIPTION index 261e25c..42a8a58 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,10 @@ Package: RCzechia Type: Package Title: Spatial Objects of the Czech Republic Version: 1.9.4 -Date: 2022-07-14 -Author: Jindra Lacko +Date: 2022-10-06 +Authors@R: + person("Jindra", "Lacko", , "jindra.lacko@gmail.com", role = c("aut", "cre"), + comment = c(ORCID = "0000-0002-0375-5156")) Maintainer: Jindra Lacko Description: Administrative regions and other spatial objects of the Czech Republic. URL: https://github.com/jlacko/RCzechia @@ -40,6 +42,6 @@ SystemRequirements: GDAL (>= 2.2.3), GEOS (>= 3.6.2), PROJ (>= 4.9.3) -RoxygenNote: 7.2.0 +RoxygenNote: 7.2.1 VignetteBuilder: knitr NeedsCompilation: no diff --git a/NEWS.md b/NEWS.md index 0419d3a..52e7752 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +## version 1.9.4 + + - fixes incorrect behavior of Vltava in Prague + + - internal optimization in line with updated dependencies + ## version 1.9.3 (2022-06-03) - fixes naming conflict between Lužnice proper (a major river) and Lužnice - tributary of Mastník (a tiny brook by Sedlčany). diff --git a/R/sysdata.rda b/R/sysdata.rda index 3157230..69860c6 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/data-raw/Dockerfile b/data-raw/Dockerfile index d2fc76c..75cc511 100644 --- a/data-raw/Dockerfile +++ b/data-raw/Dockerfile @@ -43,22 +43,29 @@ RUN apt-get update && apt-get -y install libjq-dev RUN apt-get update && apt-get -y install libprotobuf-dev RUN apt-get update && apt-get -y install protobuf-compiler RUN apt-get update && apt-get -y install libxtst6 +RUN apt-get update && apt-get -y install libfontconfig1-dev +RUN apt-get update && apt-get -y install libharfbuzz-dev +RUN apt-get update && apt-get -y install libfribidi-dev +RUN apt-get update && apt-get -y install libfreetype6-dev +RUN apt-get update && apt-get -y install libpng-dev +RUN apt-get update && apt-get -y install libtiff5-dev +RUN apt-get update && apt-get -y install libjpeg-dev RUN ldconfig # and finally! set up R packages / frozen in time to keep consistent -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('devtools')) install.packages(c('devtools'))" -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('dplyr')) install.packages(c('dplyr'))" -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('sp')) install.packages(c('sp'))" -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('lwgeom')) install.packages(c('lwgeom'))" -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('sf')) install.packages(c('sf'))" -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('czso')) install.packages(c('czso'))" -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('BH')) install.packages(c('BH'))" -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('data.table')) install.packages(c('data.table'))" -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('nngeo')) install.packages(c('nngeo'))" -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('rmapshaper')) install.packages(c('rmapshaper'))" -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('ggplot2')) install.packages(c('ggplot2'))" -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('usethis')) install.packages(c('usethis'))" -RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2021-12-31')); if(!require('rlang')) install.packages(c('rlang'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('devtools')) install.packages(c('devtools'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('dplyr')) install.packages(c('dplyr'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('sp')) install.packages(c('sp'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('lwgeom')) install.packages(c('lwgeom'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('sf')) install.packages(c('sf'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('czso')) install.packages(c('czso'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('BH')) install.packages(c('BH'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('data.table')) install.packages(c('data.table'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('nngeo')) install.packages(c('nngeo'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('rmapshaper')) install.packages(c('rmapshaper'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('ggplot2')) install.packages(c('ggplot2'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('usethis')) install.packages(c('usethis'))" +RUN R -e "options(repos = list(CRAN = 'http://mran.revolutionanalytics.com/snapshot/2022-09-30')); if(!require('rlang')) install.packages(c('rlang'))" # bleeding edge RCzechia, current CRAN (not really frozen in time, but under control) RUN R -e "install.packages('RCzechia')" diff --git a/data-raw/lo-res-polygons.R b/data-raw/lo-res-polygons.R index a5c17ee..350c609 100644 --- a/data-raw/lo-res-polygons.R +++ b/data-raw/lo-res-polygons.R @@ -10,7 +10,6 @@ for (kod in unique(okresy_low_res$KOD_CZNUTS3)) { st_union() %>% st_sf() %>% nngeo::st_remove_holes() %>% - rename(geometry = geom) %>% mutate( KOD_KRAJ = unique(okresy_low_res$KOD_KRAJ[okresy_low_res$KOD_CZNUTS3 == kod]), KOD_CZNUTS3 = unique(okresy_low_res$KOD_CZNUTS3[okresy_low_res$KOD_CZNUTS3 == kod]), @@ -28,8 +27,6 @@ for (kod in unique(okresy_low_res$KOD_CZNUTS3)) { } } -st_geometry(kraje_low_res) <- "geometry" - # ze STČ vyříznout Prahu kraje_low_res[kraje_low_res$KOD_KRAJ=="3026",] <- st_difference(kraje_low_res[kraje_low_res$KOD_KRAJ=="3026",], st_geometry(kraje_low_res[kraje_low_res$KOD_KRAJ=="3018",])) @@ -57,10 +54,8 @@ st_geometry(okresy_low_res) <- geometrie republika_low_res <- okresy_low_res %>% # select the non-central parts summarize(NAZ_STAT = republika()$NAZ_STAT) %>% # return back the data value - nngeo::st_remove_holes() %>% - rename(geometry = geom) + nngeo::st_remove_holes() -st_geometry(republika_low_res) <- "geometry" # úklid okresy_low_res <- st_transform(okresy_low_res, 4326) # WGS84 diff --git a/data-raw/reky_mesta.R b/data-raw/reky_mesta.R index 01a825d..0000bb2 100644 --- a/data-raw/reky_mesta.R +++ b/data-raw/reky_mesta.R @@ -1,7 +1,7 @@ okresy <- readRDS("./data-backup/Okresy-R-2021-01.rds") -reky <- readRDS("./data-backup/Reky-D200-2021-07.rds") %>% +reky <- readRDS("./data-backup/Reky.rds") %>% select(NAZEV) brno <- okresy %>% @@ -14,6 +14,7 @@ svitava_brno <- reky %>% st_intersection(st_buffer(brno, 1200)) %>% st_transform(4326) %>% st_geometry() %>% + st_union() %>% st_as_sf() %>% mutate(NAZEV = "Svitava") @@ -23,6 +24,7 @@ svratka_brno <- reky %>% st_intersection(st_buffer(brno, 1200)) %>% st_transform(4326) %>% st_geometry() %>% + st_union() %>% st_as_sf() %>% mutate(NAZEV = "Svratka") @@ -44,7 +46,7 @@ reky_praha <- reky %>% st_transform(4326) %>% st_geometry() %>% st_union() %>% - st_line_merge() %>% +# st_line_merge() %>% st_as_sf() %>% mutate(NAZEV = "Vltava") diff --git a/tests/testthat/test-3-integrace.R b/tests/testthat/test-3-integrace.R index 552ee2c..16f5b1b 100644 --- a/tests/testthat/test-3-integrace.R +++ b/tests/testthat/test-3-integrace.R @@ -133,5 +133,25 @@ test_that("dopady 51/2020 Sb.", { expect_equal(st_join(veznice, orp_polygony(), left = F)$KOD_ORP, "6102") # Havlíčkův Brod }) +test_that("Vltava dělí Prahu na dvě půlky", { + + skip_on_cran() + + # polygon Praha + praha <- kraje() %>% + filter(KOD_CZNUTS3 == "CZ010") + + # řeka Vltava + reka <- reky("Praha") + + # Praha říznutá na půlky + pulky <- praha %>% + st_geometry() %>% + lwgeom::st_split(reka) %>% # polygon říznutý čárou + st_cast() + + expect_equal(length(pulky), 2) # dvě půlky z jednoho celku + +})