create.buffer {marmap} | R Documentation |
Create a buffer of specified radius around one or several points
Description
Create a circular buffer of user-defined radius around one or several points defined by their longitudes and latitudes.
Usage
create.buffer(x, loc, radius, km = FALSE)
Arguments
x |
an object of class |
loc |
a 2-column |
radius |
|
km |
|
Details
This function takes advantage of the buffer
function from package adehabitatMA
and several functions from packages sp
to define the buffer around the points provided by the user.
Value
An object of class bathy
of the same size as mat
containing only NA
s outside of the buffer and values of depth/altitude (taken from mat
) within the buffer.
Author(s)
Benoit Simon-Bouhet
See Also
outline.buffer
, combine.buffers
, plot.bathy
Examples
# load and plot a bathymetry
data(florida)
plot(florida, lwd = 0.2)
plot(florida, n = 1, lwd = 0.7, add = TRUE)
# add a point around which a buffer will be created
loc <- data.frame(-80, 26)
points(loc, pch = 19, col = "red")
# compute and print buffer
buf <- create.buffer(florida, loc, radius=1.5)
buf
# highlight isobath with the buffer and add outline
plot(buf, outline=FALSE, n = 10, col = 2, lwd=.4)
plot(buf, lwd = 0.7, fg = 2)