This Function creates a bbox for usage with get_stadia_map()
or get_google_map()
. Exactly one set of
(x, y, r) or (x, y, w, h) or (x1, y1, x2, y2) must be supplied as arguments. The actual position, width and height
in the resulting map can slightly differ on behalf of the projections from LV95 (EPSG:2056) to WSG84 (EPSG:4326) to
Pseudo Mercator (EPSG:3857). But should be negligible in most cases.
Arguments
- x
LV95 x coordinate of center in m
- y
LV95 y coordinate of center in m
- r
radius around center in m (defines a quadrat)
- w
width of box in m (defines a rectancle)
- h
height of box in m (defines a rectancle)
- x1
left side (lower left point together with y1) in m
- y1
bottom side (lower left point together with x1) in m
- x2
right side (upper right point together with x2) in m
- y2
top side (upper right point together with y2) in m
Value
bbox as list with left, right, bottom, top, center = (lon, lat) as WSG84 coordinates, width and height in m
Examples
# use in this form for background maps in polar plots
bbox_lv95(2683141, 1249040, 500)
#> $left
#> [1] 8.533037
#>
#> $right
#> [1] 8.546465
#>
#> $bottom
#> [1] 47.38251
#>
#> $top
#> [1] 47.39138
#>
#> $center
#> lon lat
#> 8.53975 47.38694
#>
#> $width
#> [1] 1000
#>
#> $height
#> [1] 1000
#>
# specific aspect ratio
bbox_lv95(2683141, 1249040, w = 700, h = 0.66 * 700)
#> $left
#> [1] 8.535073
#>
#> $right
#> [1] 8.544428
#>
#> $bottom
#> [1] 47.38491
#>
#> $top
#> [1] 47.38898
#>
#> $center
#> lon lat
#> 8.53975 47.38694
#>
#> $width
#> [1] 700
#>
#> $height
#> [1] 462
#>
# from a bounding box in LV95
bbox_lv95(x1 = 2683000, y1 = 1249000, x2 = 2683700, y2 = 1249500)
#> $left
#> [1] 8.537876
#>
#> $right
#> [1] 8.547239
#>
#> $bottom
#> [1] 47.3866
#>
#> $top
#> [1] 47.39101
#>
#> $center
#> lon lat
#> -19.91546 32.12763
#>
#> $width
#> [1] 700
#>
#> $height
#> [1] 500
#>