Skip to content

Commit

Permalink
close src-review (#20)
Browse files Browse the repository at this point in the history
* sqlite work started; obce in (ciselniky remain 2 do)

* číselníky in principle working; raw csv gitignored (easily downloaded from czso.cz)

* vazby vypadají cajk; now views, you old nipponese!

* czso.cz codetables digested

* chráněná území based on AOPK open data / closes #18

* news updated / chráněná území

* function union_sf is being deprecated

* no warning if being tested

* union_sf purged from vignette & readme; deprecation mentioned in news

* date of compilation included in dataset descripton / relates to #18

* ZUJ is not a recognized dimension of obce anymore

* new structures propagated to aws; okresní data removed from ORP (m:n does not work)

* 2020-09 objects generated on ancient PROJ for compatibility reasons

* xenia >> bionic (it's 2020!)

* a desperate workaround of GDAL issues

* still desperate, but somewhat neater, workaround around WKT2 on Travis

* unstable ubuntugis for a more current GDAL on Travis

* only freshest gdal is fresh enough

* out with the silly workaround for ancient gdal on Travis!

* + unit tests for admin areas / known locations

* + unit tests for admin areas / known locations

* cleanup of vignette / more tidyverse, less dollars
  • Loading branch information
jlacko committed Sep 10, 2020
1 parent a0af01b commit be4f3f4
Show file tree
Hide file tree
Showing 52 changed files with 25,537 additions and 123 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Expand Up @@ -4,3 +4,9 @@
.Ruserdata
inst/doc
/data-raw/*.xml
/data-raw/*.cpg
/data-raw/*.dbf
/data-raw/*.shp
/data-raw/*.shx
/data-raw/*.prj

10 changes: 6 additions & 4 deletions .travis.yml
@@ -1,6 +1,6 @@
language: r
os: linux
dist: xenial
dist: bionic

cache:
packages: yes
Expand All @@ -11,12 +11,14 @@ r_packages:
- roxygen2
- covr

before_install:
- sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable -y
- sudo apt-get --yes --force-yes update -qq
- sudo apt-get install libgdal-dev libgeos-dev libproj-dev

addons:
apt:
packages:
- libproj-dev
- libgdal-dev
- libgeos-dev
- libv8-3.14-dev
- libudunits2-dev
- libprotobuf-dev
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,8 +1,8 @@
Package: RCzechia
Type: Package
Title: Spatial Objects of the Czech Republic
Version: 1.5.3
Date: 2020-08-26
Version: 1.6.0
Date: 2020-09-09
Author: Jindra Lacko
Maintainer: Jindra Lacko <jindra.lacko@gmail.com>
Description: Administrative regions and other spatial objects of the Czech Republic.
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
@@ -1,3 +1,15 @@
## version 1.6.0

- protected areas (chráněná území) based on AOPK open data instead of former ARC ČR500; the AOPK data are more current

- small scale protected areas (maloplošná chráněná území) are included in output of chr_uzemi(); extra dimension to the dataset to diffentiate small and large scale protected areas added. The downloaded file size increased to 7 MB.

- dimension of ZUJ (základní územní jednotka) removed from obce datasets, in line with move to RÚIAN as main source of administrative units. RÚIAN does not support this metric, and it does not map easily to obce (a ZUJ is sometimes an obec, and sometimes a část).

- union_sf() function is deprecated, as it has little connection to the Czech Republic; it is being moved to (so far experimental) package of spatial helper functions

- dimensionality of ORP (obce s rozšířenou působností) was reduced - district / okres and shortened name were removed. This reflects the cardinality of dimensions - ORP do not map to okres 1:n, but m:n (several ORPs are spread over multiple districts, eg. Jihlava, Tanvald or Stod). Kraj was retained, as it maps 1:n (each ORP can be mapped to a single kraj).

## version 1.5.3

- bugfix in simplified shapefiles / kraje("low")
Expand Down
4 changes: 3 additions & 1 deletion R/casti.R
Expand Up @@ -2,7 +2,9 @@
#'
#' Function taking no parameters and returning data frame of districts of Prague and other major cities as \code{sf} polygons.
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size is 593.6 KB.
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#'
#' The data is current to September 2016. Downloaded size is <1 MB.
#'
#'
#' @format \code{sf} data frame with 142 rows of 4 variables + geometry
Expand Down
13 changes: 8 additions & 5 deletions R/chr_uzemi.R
Expand Up @@ -2,22 +2,25 @@
#'
#' Function returning data frame of protected natural areas (Chráněná území) of the Czech Republic as \code{sf} polygons. It has no obligatory parameters.
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size is 114 KB.
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#'
#' The data is current to September 2020. Downloaded size is 7 MB (so use with caution, and patience).
#'
#' @format \code{sf} data frame with 36 rows of 2 variables + geometry
#'
#' @format \code{sf} data frame with 2677 rows of 3 variables + geometry
#'
#' \describe{
#' \item{TYP}{Type of protected area: Národní park, Chráněná krajinná oblast}
#' \item{TYP}{Type of protected area}
#' \item{NAZEV}{Name, with Czech accents}
#' \item{PLOCHA}{type of protected area: large or small}
#' }
#'
#' @source \url{https://www.arcdata.cz/produkty/geograficka-data/arccr-500}
#' @source (c) AOPK ČR \url{https://data.nature.cz/}
#'
#'
#' @export

chr_uzemi <- function() {
result <- downloader("ChrUzemi.rds")
result <- downloader("ChrUzemiAOPK.rds")
result
}
6 changes: 4 additions & 2 deletions R/kraje.R
Expand Up @@ -2,7 +2,9 @@
#'
#' Function returning data frame of NUTS3 administrative units for the Czech Republic as \code{sf} polygons. It takes a single parameter resolution - high res (default) or low res polygons.
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size of high resolution shapefile is <1 MB.
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#'
#' The data is current to September 2020. Downloaded size of high resolution shapefile is <1 MB.
#'
#' @param resolution Should the function return high or low resolution shapefile? Allowed values are "high" (default) and "low". This parameter affects only the geometry column, all other fields remain the same.
#'
Expand Down Expand Up @@ -31,7 +33,7 @@ kraje <- function(resolution = "high") {
if (resolution == "low") {
return(kraje_low_res)
} else {
result <- downloader("Kraje-R.rds")
result <- downloader("Kraje-R-2020-09.rds")
result
}
}
3 changes: 2 additions & 1 deletion R/lesy.R
Expand Up @@ -2,7 +2,8 @@
#'
#' Function returning data frame of woodland areas (lesy) of more than 30 hectares in are of the Czech Republic as \code{sf} polygons. It has no obligatory parameters.
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size is 2.1 MB.
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#' The data is current to September 2016. Downloaded size is 2.1 MB.
#'
#' @format \code{sf} data frame with 2.366 rows of geometry variable only
#'
Expand Down
8 changes: 4 additions & 4 deletions R/obce_body.R
Expand Up @@ -2,15 +2,15 @@
#'
#' Function returning data frame of LAU2 administrative units for the Czech Republic as \code{sf} points. It takes no parameters.
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size is 270 KB.
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#'
#' The data is current to September 2020. Downloaded size is <1 MB.
#'
#' @format \code{sf} data frame with 6.258 rows of 14 variables + geometry
#'
#' \describe{
#' \item{KOD_OBEC}{Code of the level I commune (obec).}
#' \item{NAZ_OBEC}{Name of the level I commune (obec).}
#' \item{KOD_ZUJ}{Code of the basic administrative unit (ICZUJ).}
#' \item{NAZ_ZUJ}{Name of the basic administrative unit (ICZUJ).}
#' \item{KOD_POU}{Code of the level II commune (obec s poverenym uradem).}
#' \item{NAZ_POU}{Name of the level II commune (obec s poverenym uradem)).}
#' \item{KOD_ORP}{Code of the level III commune (obec s rozsirenou pusobnosti).}
Expand All @@ -30,6 +30,6 @@
#' @export

obce_body <- function() {
result <- downloader("ObceB-R.rds")
result <- downloader("ObceB-R-2020-09.rds")
result
}
8 changes: 4 additions & 4 deletions R/obce_polygony.R
Expand Up @@ -2,15 +2,15 @@
#'
#' Function returning data frame of LAU2 administrative units for the Czech Republic as \code{sf} polygons. It takes no parameters.
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size is 13.3 MB (so use with caution, and patience).
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#'
#' The data is current to September 2020. Downloaded size is 13.3 MB (so use with caution, and patience).
#'
#' @format \code{sf} data frame with 6.258 rows of 14 variables + geometry
#'
#' \describe{
#' \item{KOD_OBEC}{Code of the level I commune (obec).}
#' \item{NAZ_OBEC}{Name of the level I commune (obec).}
#' \item{KOD_ZUJ}{Code of the basic administrative unit (ICZUJ).}
#' \item{NAZ_ZUJ}{Name of the basic administrative unit (ICZUJ).}
#' \item{KOD_POU}{Code of the level II commune (obec s poverenym uradem).}
#' \item{NAZ_POU}{Name of the level II commune (obec s poverenym uradem)).}
#' \item{KOD_ORP}{Code of the level III commune (obec s rozsirenou pusobnosti).}
Expand All @@ -37,6 +37,6 @@
#' @export

obce_polygony <- function() {
result <- downloader("ObceP-R.rds")
result <- downloader("ObceP-R-2020-09.rds")
result
}
6 changes: 4 additions & 2 deletions R/okresy.R
Expand Up @@ -2,7 +2,9 @@
#'
#' Function returning data frame of LAU1 administrative units for the Czech Republic as \code{sf} polygons. It takes a single parameter resolution - high res (default) or low res polygons.
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size of high resolution shapefile is 1 MB (so use with caution, and patience).
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#'
#' The data is current to September 2020. Downloaded size of high resolution shapefile 1 MB.
#'
#' @param resolution Should the function return high or low resolution shapefile? Allowed values are "high" (default) and "low". This parameter affects only the geometry column, all other fields remain the same.
#'
Expand Down Expand Up @@ -37,7 +39,7 @@ okresy <- function(resolution = "high") {
if (resolution == "low") {
return(okresy_low_res)
} else {
result <- downloader("Okresy-R.rds")
result <- downloader("Okresy-R-2020-09.rds")
result
}
}
18 changes: 7 additions & 11 deletions R/orp_polygony.R
Expand Up @@ -2,22 +2,18 @@
#'
#' Function returning data frame of municipalities with extended powers (obce s rozšířenou působností) as \code{sf} polygons. It takes no parameters.
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size is 1.2 MB (so use with caution, and patience).
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#'
#' @format \code{sf} data frame with 206 rows of 10 variables + geometry
#' The data is current to September 2020. Downloaded size is 1.5 MB.
#'
#' @format \code{sf} data frame with 206 rows of 5 variables + geometry
#'
#' \describe{
#' \item{KOD_ORP}{Code of the level III commune (obec s rozsirenou pusobnosti).}
#' \item{NAZ_ZKR_ORP}{Short name of the level III commune (obec s rozsirenou pusobnosti).}
#' \item{NAZ_ORP}{Full name of the level III commune (obec s rozsirenou pusobnosti).}
#' \item{KOD_RUIAN}{RUIAN (Registr uzemni identifikace, adres a nemovitosti) code.}
#' \item{KOD_OKRES}{Code of the district (okres).}
#' \item{KOD_LAU1}{Code of the LAU1 administrative unit (okres).}
#' \item{NAZ_LAU1}{Name of the LAU1 administrative unit (okres).}
#' \item{KOD_KRAJ}{Code of the region (kraj).}
#' \item{KOD_KRAJ}{Code of the region (kraj).}
#' \item{KOD_CZNUTS2}{Code of the NUTS3 unit (kraj)}
#' \item{NAZ_CZNUTS2}{Name of the NUTS3 unit (kraj)}
#' \item{KOD_CZNUTS3}{Code of the NUTS3 unit (kraj)}
#' \item{NAZ_CZNUTS3}{Name of the NUTS3 unit (kraj)}
#' }
#'
#'
Expand All @@ -27,6 +23,6 @@
#' @export

orp_polygony <- function() {
result <- downloader("ORP-R.rds")
result <- downloader("ORP-R-2020-09.rds")
result
}
4 changes: 3 additions & 1 deletion R/plochy.R
Expand Up @@ -2,7 +2,9 @@
#'
#' Function returning data frame of water bodies of the Czech Republic as \code{sf} polygons. It takes no parameters.
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size is 118.6 KB.
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#'
#' The data is current to September 2016. Downloaded size is <1 MB.
#'
#' @format \code{sf} data frame with 480 rows of 5 variables + geometry
#'
Expand Down
4 changes: 3 additions & 1 deletion R/reky.R
Expand Up @@ -4,7 +4,9 @@
#'
#' Two special case scopes are defined: Praha (returning the part of Vltava in and around Prague) and Brno (returning Svitava and Svratka near and around Brno).
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size is 1 MB.
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#'
#' The data is current to September 2016. Downloaded size is 1 MB.
#'
#' @param scope Should the function return all rivers, or just Vltava in Prague / Svitava & Svratka in Brno?
#'
Expand Down
4 changes: 3 additions & 1 deletion R/republika.R
Expand Up @@ -2,7 +2,9 @@
#'
#' Boundaries of the Czech Republic as \code{sf} polygon.
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size of high resolution shapefile is <1 MB.
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#'
#' The data is current to September 2020. Downloaded size of high resolution shapefile is <1 MB.
#'
#' @param resolution Should the function return high or low resolution shapefile? Allowed values are "high" (default) and "low". This parameter affects only the geometry column, all other fields remain the same.
#'
Expand Down
4 changes: 3 additions & 1 deletion R/silnice.R
Expand Up @@ -2,7 +2,9 @@
#'
#' Function returning data frame of roads of the Czech Republic as \code{sf} lines. It has no obligatory parameters.
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size is 1.5 MB.
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#'
#' The data is current to September 2016. Downloaded size is 1.5 MB.
#'
#' @format \code{sf} data frame with 18.979 rows of 4 variables + geometry:
#'
Expand Down
4 changes: 4 additions & 0 deletions R/union_sf.R
Expand Up @@ -26,6 +26,10 @@
#' }
#'
union_sf <- function(data, key, tolerance = 1, planar_CRS = 5514) {

# give out a deprecation warning / unless in process of being tested
if (!identical(Sys.getenv("TESTTHAT"), "true")) .Deprecated(msg = "function union_sf is being moved to package sfhelp; it will be removed in a coming version")

if (missing(data)) stop("required argument `data` is missing")
if (missing(key)) stop("required argument `key` is missing")
if (length(key) != 1) stop("a single `key` value is required")
Expand Down
4 changes: 3 additions & 1 deletion R/vyskopis.R
Expand Up @@ -6,7 +6,9 @@
#'
#' The raster is 5084 by 3403 cells, meaning each pixel is about 90 × 90 meters. It works the best at level of country or regions, at the level of a city or lower it may be somewhat grainy.
#'
#' Due to package size constraints both versions are stored externally (and a working internet connection is required to use the package). Downloaded size of the rayshaded raster is 8.4 MB, actual raster is 31.4 MB.
#' Due to package size constraints both versions are stored externally (and a working internet connection is required to use the package).
#'
#' The data is current to September 2016. Downloaded size of the rayshaded raster is 8.4 MB, actual raster is 31.4 MB.
#'
#' @param format Should the function return actual relief (meters above sea level) or shaded relief (rayshaded). Allowed values are "actual" and "rayshaded".
#'
Expand Down
4 changes: 3 additions & 1 deletion R/zeleznice.R
Expand Up @@ -2,7 +2,9 @@
#'
#' Function returning data frame of railroads of the Czech Republic as \code{sf} lines. It has no obligatory parameters.
#'
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package). Downloaded size is 285 KB.
#' Due to package size constraints the data are stored externally (and a working internet connection is required to use the package).
#'
#' The data is current to September 2016. Downloaded size is <1 MB.
#'
#' @format \code{sf} data frame with 3.525 rows of 4 variables + geometry:
#'
Expand Down
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -67,7 +67,6 @@ Key is KOD.
All objects are implemented as functions returning data frames, so must be followed by brackets (i.e. `hranice <- republika()`).

### In addition a number of utility functions is provided:
* **union_sf**: dissolves `sf` polygons according to a key value
* **geocode**: interfaces to geocoding API of [ČÚZK](https://cuzk.cz/en).
* **revgeo**: interfaces to reverse geocoding API of [ČÚZK](https://cuzk.cz/en).

Binary file added data-backup/ChrUzemiAOPK.rds
Binary file not shown.
Binary file added data-backup/Kraje-R-2020-09.rds
Binary file not shown.
Binary file added data-backup/ORP-R-2020-09.rds
Binary file not shown.
Binary file added data-backup/ObceB-R-2020-09.rds
Binary file not shown.
Binary file added data-backup/ObceP-R-2020-09.rds
Binary file not shown.
Binary file added data-backup/Okresy-R-2020-09.rds
Binary file not shown.

0 comments on commit be4f3f4

Please sign in to comment.