Last chance! 50% off unlimited learning
Sale ends in
Takes a geographic object or bounding box as an input and outputs a bounding box, represented as a bounding box, corner points or rectangular polygon.
geo_bb(
shp,
scale_factor = 1,
distance = 0,
output = c("polygon", "points", "bb")
)
Spatial object (from sf or sp packages)
Numeric vector determining how much the bounding box will grow or shrink. Two numbers refer to extending the bounding box in x and y dimensions, respectively. If the value is 1, the output size will be the same as the input.
Distance in metres to extend the bounding box by
Type of object returned (polygon by default)
bb_scale
Other geo:
bbox_scale()
,
gclip()
,
geo_bb_matrix()
,
mapshape_available()
,
mapshape()
,
quadrant()
,
reproject()
# NOT RUN {
# Simple features implementation:
shp <- routes_fast_sf
shp_bb <- geo_bb(shp, distance = 100)
plot(shp_bb, col = "red", reset = FALSE)
plot(geo_bb(routes_fast_sf, scale_factor = 0.8), col = "green", add = TRUE)
plot(geo_bb(routes_fast_sf, output = "points"), add = TRUE)
plot(routes_fast_sf$geometry, add = TRUE)
geo_bb(routes_fast, scale_factor = c(2, 1.1), output = "bb")
# sp implemantation
shp <- routes_fast
shp_bb <- geo_bb(shp, distance = 100)
plot(shp_bb, col = "red")
plot(geo_bb(routes_fast, scale_factor = 0.8), col = "green", add = TRUE)
plot(geo_bb(sp::bbox(routes_fast)), add = TRUE) # works on bb also
plot(geo_bb(routes_fast, output = "points"), add = TRUE)
# }
Run the code above in your browser using DataLab