adehabitat (version 1.8.20)

buffer: Compute Buffers

Description

buffer compute buffers around a set of locations. buffer.ani is to be used when the points can be grouped into several categories (e.g. the relocations of several animals monitored using radio-tracking; the function buffer is then applied to each animal). buffer.line compute buffers around a line. buffer.ltraj compute buffers around one or several animals trajectories.

Usage

buffer(pts, x, dist)
buffer.ani(pts, fac, x, dist)
buffer.line(xy, x, dist)
buffer.ltraj(ltraj, x, dist, perani=FALSE)

Arguments

pts

a data frame with two columns (x and y coordinates of the points)

x

either an object of class asc or kasc with the same attributes as those desired for the output, or an object of class mapattr (see storemapattr)

dist

a value of distance

fac

a factor defining the categories of the points

xy

a data frame containing the coordinates of the vertices of the lines

ltraj

an object of class ltraj

perani

logical. If FALSE, one buffer is computed for each burst of relocation. If TRUE, the buffers are computed per levels of the attribute id.

Value

buffer and buffer.line return an object of class asc, with 1 for pixels located within a specified distance of given points, and NA otherwise. buffer.ani returns a data frame of class kasc, with each column corresponding to one level of the factor fac. buffer.ltraj returns a data frame of class kasc, with each column corresponding to one level of the attribute id of the object of class ltraj passed as argument.

See Also

kasc for additionnal information on objects of class kasc, asc for further information on objects of class asc, storemapattr for further information on objects of class mapattr.

Examples

Run this code
# NOT RUN {
data(puechabon)

# locs is the data frame containing the
# relocations of wild boars monitored by radio-tracking 
locs <- puechabon$locs

# sa is the "kasc" object of maps of the study area
sa <- puechabon$kasc

# Buffer of 500 m around all relocations
bu <- buffer(locs[,4:5], sa, 500)
image(bu)

# displays all the pixels of the study area within 500 m
# of a relocation of each monitored wild boar
buani <- buffer.ani(locs[,4:5], locs[,1], sa, 500)
image(buani)


## buffer around a trajectory
data(puechcirc)
image(buffer.ltraj(puechcirc,sa, 100))

## buffer around a line
gc <- getcontour(getkasc(sa,1))
out <- buffer.line(gc[,2:3], sa, 300)
image(out)
lines(gc[,2:3], lwd=2)



# }

Run the code above in your browser using DataCamp Workspace