create.buffer: Create a buffer of specified radius around one or several...

View source: R/create.buffer.R

create.bufferR 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 bathy

loc

a 2-column data.frame of longitudes and latitudes for points around which the buffer is to be created.

radius

numeric. Radius of the buffer in the same unit as the bathy object (i.e. usually decimal degrees) when km=FALSE (default) or in kilometers when radius=TRUE.

km

logical. If TRUE, the radius should be provided in kilometers. When FALSE (default) the radius is in the same unit as the bathy object (i.e. usually decimal degrees).

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 NAs 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)

marmap documentation built on March 31, 2023, 6:59 p.m.

Related to create.buffer in marmap...