Get a bounding box buffered a set distance or to match an aspect ratio
Source:R/st_bbox_ext.R
st_bbox_ext.Rd
st_bbox_ext()
converts the input to a bounding box with as_bbox()
,
applies a buffer (based on a specified distance or proportion of the diagonal
distance across the bounding box) and adjusts the bounding box aspect ratio
before returning a bounding box (or another class specified by the class
parameter). If the input object is a list or sf_list
object, the function
always returns a list
or sf_list
.
Usage
st_bbox_ext(
x,
dist = NULL,
diag_ratio = NULL,
asp = NULL,
unit = NULL,
crs = NULL,
class = "bbox",
nudge = NULL,
allow_null = TRUE,
allow_list = TRUE
)
st_bbox_asp(
x,
asp = NULL,
class = "bbox",
allow_null = TRUE,
allow_list = TRUE
)
Arguments
- x
A
sf
,sfc
,bbox
,sfg
,Raster
,Spatial
,Extent
,numeric
, orcharacter
object (a place name passed toosmdata::getbb()
). Seeas_bbox()
for more details.- dist
buffer distance in units. Optional.
- diag_ratio
ratio of diagonal distance of area's bounding box used as buffer distance. e.g. if the diagonal distance is 3000 meters and the "diag_ratio = 0.1" a 300 meter will be used. Ignored when
dist
is provided.- asp
Aspect ratio of width to height as a numeric value (e.g. 0.33) or character (e.g. "1:3"). If numeric,
get_asp()
returns the same value without modification.- unit
Units for buffer. Supported options include "meter", "foot", "kilometer", and "mile", "nautical mile" Common abbreviations (e.g. "km" instead of "kilometer") are also supported. Distance in units is converted to units matching GDAL units for x; defaults to "meter"
- crs
Coordinate reference system of bounding box to return; defaults to
NULL
which maintains the crs of the input object.- class
Class of object to return passed to
as_sf_class()
; defaults to "bbox".- nudge
Passed as to parameter
st_nudge()
when notNULL
. A numeric vector, asf
object, or any other object that can be converted to a simple feature collection withas_sfc()
..- allow_null
If
TRUE
(default) and x isNULL
, returnNULL
or, ifFALSE
, abort function.- allow_list
If
TRUE
(default), allow sf list objects as an input and usepurrr::map()
to apply the provided parameters to each object within the list to return as a new sf list object.