View source: R/create.buffer.R
create.buffer | R Documentation |
Create a circular buffer of user-defined radius around one or several points defined by their longitudes and latitudes.
create.buffer(x, loc, radius, km = FALSE)
x |
an object of class |
loc |
a 2-column |
radius |
|
km |
|
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.
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.
Benoit Simon-Bouhet
outline.buffer
, combine.buffers
, plot.bathy
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.