Learn R Programming

adehabitatMA (version 0.3.17)

ascgen: Making Raster Maps From SpatialPoints Objects

Description

ascgen creates an object of class SpatialPixelsDataFrame using a set of points contained in an object of class SpatialPointsDataFrame.

Usage

ascgen(xy, cellsize = NULL, nrcol = NULL, count = TRUE)

Value

Returns an object of class SpatialPixelsDataFrame.

Arguments

xy

an object inheriting the class SpatialPoints

cellsize

the cell size (resolution) of the object of class SpatialPixelsDataFrame to be built

nrcol

the size of the square raster map to be created (number of rows/columns)

count

logical. If TRUE, the resulting object contains the number of points in each cell. If FALSE, all the cells are set to zero

Author

Clement Calenge clement.calenge@ofb.gouv.fr

See Also

SpatialPixelsDataFrame-class for additional information on objects of class SpatialPixelsDataFrame and SpatialPoints-class for additional information on objects of class SpatialPoints.

Examples

Run this code

## generates a random sample of points
xy <- matrix(runif(1000), ncol=2)

## coerce them to SpatialPoints
xy <- SpatialPoints(xy)
plot(xy)

## generate a SpatialPixelsDataFrame
## (and count the number of points)
spd <- ascgen(xy, cellsize=0.1)
image(spd)


Run the code above in your browser using DataLab