This functions takes in a border and can either shift, shrink, or rotate it. All of them can be done together as well. This usually takes a bit of trial and error, so make sure to plot the result each time. For a detailed walk through check out the according vignette: vignette(shifting_borders).

shift_border(
  border,
  operation = c("shift", "scale", "rotate"),
  shift = c(0, 0),
  scale = 1,
  angle = 0
)

Arguments

border

sf object with line geometry

operation

"shift", "rotate", "scale" - or a combination of them

shift

if operation = "shift", shift distance in CRS units (if UTM it is metres) for x and y coordinates as c(dist_x, dist_y)

scale

if operation = "scale", provide shrinkage/growth factor: e.g. .9 to shrink by 10perc. and 1.1 to increase by 10perc.

angle

if operation = "rotate", provide angle in degrees

Value

a new border in the form of an sf object

Examples

shift_border(border = cut_off, operation = c("shift", "scale"),
shift = c(-5000, -3000), scale = .85)
#> Simple feature collection with 1 feature and 0 fields
#> Geometry type: MULTILINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: 364946.4 ymin: 1676336 xmax: 394294.4 ymax: 1727769
#> Projected CRS: WGS 84 / UTM zone 43N
#>                       border_sfc
#> 1 MULTILINESTRING ((364946.4 ...

shift_border(border = cut_off, operation = "rotate", angle = 10)
#> Simple feature collection with 1 feature and 0 fields
#> Geometry type: MULTILINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: 369882.1 ymin: 1674097 xmax: 397093.6 ymax: 1735077
#> Projected CRS: WGS 84 / UTM zone 43N
#>                       border_sfc
#> 1 MULTILINESTRING ((369882.1 ...