Skip to content

Commit

Permalink
data(vg250): update
Browse files Browse the repository at this point in the history
fixes #17
  • Loading branch information
dimfalk committed Jun 20, 2024
1 parent 434e9ca commit ea39daa
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: vg250
Title: R Interface for VG250 Dataset Subset
Version: 0.5.5
Date: 2024-04-03
Version: 0.5.6
Date: 2024-06-20
Authors@R:
person("Dimitri", "Falk", , "falk.dimitri@eglv.de", role = c("aut", "cre"))
Description: Obtain feature geometries, bounding boxes and centroids of
Expand Down
14 changes: 7 additions & 7 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#' Data: Polygon representation of administrative areas in Germany (VG250-EW 31.12.2021)
#' Data: Polygon representation of administrative areas in Germany (VG250-EW 31.12.2022)
#'
#' VG250 product provided by the Federal Agency for Cartography and Geodesy, Germany
#'
#' @format Simple feature collection of type MULTIPOLYGON with 10,994 features and 6 fields:
#' @format Simple feature collection of type MULTIPOLYGON with 10,990 features and 6 fields:
#' \describe{
#' \item{GEM}{character. Municipality name, "GEM" level.}
#' \item{KRS}{character. District name, "KRS" level.}
#' \item{LAN}{character. State name, "LAN" level.}
#' \item{GEM}{character. Municipality name, 'GEM' level.}
#' \item{KRS}{character. District name, 'KRS' level.}
#' \item{LAN}{character. State name, 'LAN' level.}
#' \item{EWZ}{integer. Number of inhabitants according to census bureau \code{[-]}.}
#' \item{KFL}{numeric. Area according to real estate cadastre \code{[km2]}.}
#'
#' \item{geom}{sfc_GEOMETRY. Coordinates.}
#' }
#' @source <https://daten.gdz.bkg.bund.de/produkte/vg/vg250-ew_ebenen_1231/aktuell/vg250-ew_12-31.utm32s.shape.ebenen.zip>
#' @note Last access: 2023-06-05
#' @note Last access: 2024-06-20
#' @description <https://gdz.bkg.bund.de/index.php/default/verwaltungsgebiete-1-250-000-mit-einwohnerzahlen-stand-31-12-vg250-ew-31-12.html>
#' @note License: Data licence Germany – attribution – version 2.0
#' @note Copyright: GeoBasis-DE / BKG 2022 (modified)
#' @note Copyright: GeoBasis-DE / BKG 2024 (modified)
"vg250"
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Just a few quick insights on the use of this package:

``` r
library(vg250)
#> 0.5.5
#> 0.5.6
```

``` r
Expand All @@ -57,7 +57,7 @@ class(buff)

``` r
class(geom)
#> [1] "sfc_MULTIPOLYGON" "sfc"
#> [1] "sfc_POLYGON" "sfc"
```

``` r
Expand Down Expand Up @@ -86,7 +86,7 @@ calls, etc.
``` r
# convert to SpatExtent object when working with `{terra}`
terra::vect(ext) |> terra::ext()
#> SpatExtent : 5.9748614, 6.2169125, 50.6488647, 50.8573535 (xmin, xmax, ymin, ymax)
#> SpatExtent : 5.9748614, 6.2169125, 50.6627898, 50.8573535 (xmin, xmax, ymin, ymax)
```

``` r
Expand All @@ -96,10 +96,10 @@ sf::st_filter(vg250, p)
#> Simple feature collection with 1 feature and 5 fields
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: 5.974861 ymin: 50.64886 xmax: 6.216912 ymax: 50.85735
#> Bounding box: xmin: 5.974861 ymin: 50.66279 xmax: 6.216912 ymax: 50.85735
#> Geodetic CRS: WGS 84
#> GEM KRS LAN EWZ KFL
#> 1 Aachen Städteregion Aachen Nordrhein-Westfalen 249070 160.85
#> 1 Aachen Städteregion Aachen Nordrhein-Westfalen 252136 160.85
#> geom
#> 1 MULTIPOLYGON (((6.057066 50...
```
Expand All @@ -111,42 +111,42 @@ sf::st_intersection(vg250, p)
#> Simple feature collection with 1 feature and 5 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 6.109715 ymin: 50.75954 xmax: 6.109715 ymax: 50.75954
#> Bounding box: xmin: 6.109002 ymin: 50.76053 xmax: 6.109002 ymax: 50.76053
#> Geodetic CRS: WGS 84
#> GEM KRS LAN EWZ KFL
#> 2145 Aachen Städteregion Aachen Nordrhein-Westfalen 249070 160.85
#> 2145 Aachen Städteregion Aachen Nordrhein-Westfalen 252136 160.85
#> geom
#> 2145 POINT (6.109715 50.75954)
#> 2145 POINT (6.109002 50.76053)
```

``` r

# construct API queries
sf::st_bbox(ext) |> as.numeric() |> round(4) |> paste0(collapse = ",") |> paste0("&bbox=", x = _)
#> [1] "&bbox=5.9749,50.6489,6.2169,50.8574"
#> [1] "&bbox=5.9749,50.6628,6.2169,50.8574"
```

Note: The VG250 dataset itself can be accessed via `vg250`:

``` r
vg250
#> Simple feature collection with 10994 features and 5 fields
#> Simple feature collection with 10990 features and 5 fields
#> Geometry type: GEOMETRY
#> Dimension: XY
#> Bounding box: xmin: 5.86625 ymin: 47.27012 xmax: 15.04182 ymax: 55.05878
#> Geodetic CRS: WGS 84
#> First 10 features:
#> GEM KRS LAN EWZ KFL
#> 1 Flensburg Flensburg Schleswig-Holstein 91113 56.73
#> 2 Kiel Kiel Schleswig-Holstein 246243 118.65
#> 3 Lübeck Lübeck Schleswig-Holstein 216277 214.19
#> 4 Neumünster Neumünster Schleswig-Holstein 79496 71.66
#> 5 Brunsbüttel Dithmarschen Schleswig-Holstein 12381 65.21
#> 6 Heide Dithmarschen Schleswig-Holstein 21844 31.97
#> 7 Averlak Dithmarschen Schleswig-Holstein 558 9.06
#> 1 Flensburg Flensburg Schleswig-Holstein 92550 56.73
#> 2 Kiel Kiel Schleswig-Holstein 247717 118.65
#> 3 Lübeck Lübeck Schleswig-Holstein 218095 214.19
#> 4 Neumünster Neumünster Schleswig-Holstein 79502 71.66
#> 5 Brunsbüttel Dithmarschen Schleswig-Holstein 12603 65.21
#> 6 Heide Dithmarschen Schleswig-Holstein 22114 31.97
#> 7 Averlak Dithmarschen Schleswig-Holstein 570 9.06
#> 8 Brickeln Dithmarschen Schleswig-Holstein 198 6.07
#> 9 Buchholz Dithmarschen Schleswig-Holstein 988 14.56
#> 10 Burg (Dithmarschen) Dithmarschen Schleswig-Holstein 4184 11.25
#> 9 Buchholz Dithmarschen Schleswig-Holstein 1001 14.56
#> 10 Burg (Dithmarschen) Dithmarschen Schleswig-Holstein 4206 11.25
#> geom
#> 1 MULTIPOLYGON (((9.412137 54...
#> 2 MULTIPOLYGON (((10.16852 54...
Expand Down
2 changes: 1 addition & 1 deletion data-raw/vg250.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fname <- "vg250-ew_12-31.utm32s.shape.ebenen.zip"

base_url <- paste0("https://daten.gdz.bkg.bund.de/produkte/vg/vg250-ew_ebenen_1231/aktuell/", fname)

# download data, set timeout to 2 minutes (~65.8 MB)
# download data, set timeout to 2 minutes (~65.6 MB)
options(timeout = max(120, getOption("timeout")))

utils::download.file(base_url, fname)
Expand Down
Binary file modified data/vg250.rda
Binary file not shown.
Binary file modified man/figures/README-example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions man/vg250.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ea39daa

Please sign in to comment.