buffer: Compute Buffers Regions

bufferR Documentation

Compute Buffers Regions

Description

buffer computes buffers regions from spatial objects belonging to the following classes:

SpatialPoints (all pixels located within a specified distance of a point take the value one)

SpatialPointsDataFrame with one column (this column is considered to be a factor, and the buffer is computed for each level of this factor)

SpatialLines to compute buffers from lines.

SpatialPolygons to compute buffers from polygons.

Usage

buffer(xy, x, dist)

Arguments

xy

an object of class SpatialPoints, SpatialPointsDataFrame with one column (a factor considered to be the identity of the points), SpatialLines, or SpatialPolygons.

x

an object inheriting the class SpatialPixels with the same attributes (resolution, size) as those desired for the output.

dist

a value of distance

Value

An object of class SpatialPixelsDataFrame.

Author(s)

Clement Calenge clement.calenge@ofb.gouv.fr

See Also

SpatialPixelsDataFrame-class for additionnal information on objects of class SpatialPixelsDataFrame.

Examples


data(lynxjura)

# locs is the SpatialPointsDataFrame containing the
# locations of lynx indices in the Jura mountains
locs <- lynxjura$locs
head(locs)

## just for the sake of illustration: sample 100 points
suppressWarnings(RNGversion("3.5.0"))
set.seed(233)
locs <- locs[sample(1:nrow(locs), 100),]

# sa is the SpatialPixelsDataFrame object containing
# maps of the study area
sa <- lynxjura$map

# Buffer of 2000 m from all points
bu <- buffer(locs, sa, 2000)
image(bu)

# displays all the pixels of the study area within 2000 m
# of a point, for each type of indices (see ?lynxjura)
buani <- buffer(locs[,2], sa, 2000)
buani
par(mar=c(0,0,2,0))
opar<-par(mfrow=c(3,4))
lapply(1:11, function(i) {
   image(buani[,i])
   title(main = names(slot(buani, "data"))[i])
})
par(opar)

## buffer from a polygon
sa2 <- sa[,4]
sa2[[1]][sa2[[1]]<5000] <- NA
image(sa2)

## gets the contour line
gc <- getcontour(sa2)
plot(gc, add=TRUE)

## a buffer of 2000 metres
image(buffer(gc, sa, 2000))
plot(gc, add=TRUE)




adehabitatMA documentation built on Sept. 11, 2024, 8:47 p.m.