50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


marmap (version 0.9.4)

combine.buffers: Create a new, composite buffer from a list of existing buffers.

Description

Create a new buffer object from a list of existing buffers of compatible dimensions.

Usage

combine.buffers(buf)

Arguments

buf
a list of 2 or more buffer objects as produced by create.buffer. All buffer objects in the list must have the same number of rows and columns.

Value

  • An object of class bathy of the same dimension as the original buffers containing only NAs outside of the combined buffer and values of depth/altitude (taken from the list of buffers buf) within the combined buffer.

See Also

create.buffer, outline.buffer, plot.bathy

Examples

Run this code
# load and plot a bathymetry
data(florida)
plot(florida, lwd = 0.2)
plot(florida, n = 1, lwd = 0.7, add = TRUE)

# add points around which a buffer will be computed
loc <- data.frame(c(-80,-82), c(26,24))
points(loc, pch = 19, col = "red")

# create 2 distinct buffer objects with different radii
buf1 <- create.buffer(florida, loc[1,], radius=1.9)
buf2 <- create.buffer(florida, loc[2,], radius=1.2)

# combine both buffers
buf <- combine.buffers(list(buf1,buf2))

# Add outline of the resulting buffer in red 
# and the outline of the original buffers in blue
plot(outline.buffer(buf), add = TRUE, lwd = 3, col = 2)
plot(outline.buffer(buf1), add = TRUE, lwd = 0.5, col="blue")
plot(outline.buffer(buf2), add = TRUE, lwd = 0.5, col="blue")

Run the code above in your browser using DataLab