dimfalk/vg250

`get_*("Bremen" | "Hamburg")`: MULTIPOLYGON objects leading to unreasonable spatial footprint

Closed this issue · 5 comments

library(vg250)

get_extent(x = "Hamburg", crs = "epsg:25832")
#> Warning in check_municipality(x): Your input returned multiple objects. Only the object with the largest number of inhabitants is processed.
#>   Consider to visually inspect the returned object using e.g. `mapview::mapview()`.
#> Geometry set for 1 feature 
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 461426.2 ymin: 5916377 xmax: 588169 ymax: 5980375
#> Projected CRS: ETRS89 / UTM zone 32N
#> POLYGON ((461426.2 5916377, 588169 5917039, 586...

dplyr::filter(vg250, GEM == "Hamburg")
#> Simple feature collection with 2 features and 4 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 8.419907 ymin: 53.39507 xmax: 10.32596 ymax: 53.9644
#> Geodetic CRS:  WGS 84
#>       GEM     KRS     LAN     EWZ                           geom
#> 1 Hamburg Hamburg Hamburg 1853935 MULTIPOLYGON (((10.18516 53...
#> 2 Hamburg Hamburg Hamburg       0 MULTIPOLYGON (((9.745421 53...

Created on 2023-06-05 with reprex v2.0.2

This seems to be a result of an exclave belongig to Hamburg: https://de.wikipedia.org/wiki/Hamburg-Neuwerk

Same also applies to "Bremen":

library(vg250)

get_extent(x = "Bremen", crs = "epsg:25832")
#> Warning in check_municipality(x): Your input returned multiple objects. Only the object with the largest number of inhabitants is processed.
#>   Consider to visually inspect the returned object using e.g. `mapview::mapview()`.
#> Geometry set for 1 feature 
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 465228 ymin: 5873497 xmax: 499398.6 ymax: 5938846
#> Projected CRS: ETRS89 / UTM zone 32N
#> POLYGON ((465228 5873622, 499390.3 5873497, 499...

dplyr::filter(vg250, GEM == "Bremen")
#> Simple feature collection with 2 features and 4 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 8.481735 ymin: 53.01102 xmax: 8.990913 ymax: 53.59733
#> Geodetic CRS:  WGS 84
#>      GEM    KRS    LAN    EWZ                           geom
#> 1 Bremen Bremen Bremen 563290 MULTIPOLYGON (((8.496958 53...
#> 2 Bremen Bremen Bremen      0 MULTIPOLYGON (((8.562229 53...

Created on 2023-06-05 with reprex v2.0.2

411 non-unique municipality names included in vg250 after filtering for KFL > 0 during pre-processing in /data-raw/:

library(vg250)

y <- vg250$GEM |> table() |> sort(decreasing = TRUE) |> as.numeric()

y[y > 1] |> length()
#> [1] 411

Exclaves seem to be part of the MULTIPOLYGON object with EWZ > 0. Use sf::st_cast("POLYGON")?

Objects with EWZ == 0 seem to be limited to water bodies and forests?

List of exclaves in Germany according to https://de.wikipedia.org/wiki/Liste_von_Exklaven_und_Enklaven#Deutschland

  • Bremen <> Bremerhaven
  • Hamburg <> Neuwerk, Scharhörn, Nigehörn
  • Kassel <> Kragenhof
  • Heppenheim (Bergstraße)
  • Breddin
  • Buckautal, Ziesar
  • Finne, Querfurt