Skip to content

Commit

Permalink
close back-2-vse (#44)
Browse files Browse the repository at this point in the history
* vltava in prague + update deps

* resolve failing CI
  • Loading branch information
jlacko authored Oct 6, 2022
1 parent d6ffb2c commit dda25ac
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 24 deletions.
8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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 <jindra.lacko@gmail.com>
Description: Administrative regions and other spatial objects of the Czech Republic.
URL: https://github.com/jlacko/RCzechia
Expand Down Expand Up @@ -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
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
33 changes: 20 additions & 13 deletions data-raw/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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')"
Expand Down
7 changes: 1 addition & 6 deletions data-raw/lo-res-polygons.R
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand All @@ -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",]))

Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions data-raw/reky_mesta.R
Original file line number Diff line number Diff line change
@@ -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 %>%
Expand All @@ -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")

Expand All @@ -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")

Expand All @@ -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")

Expand Down
20 changes: 20 additions & 0 deletions tests/testthat/test-3-integrace.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

})


0 comments on commit dda25ac

Please sign in to comment.