extract.data: Spatial Join of Points with Raster Grids

Description Usage Arguments Details Value Author(s) Examples

Description

extract.data extracts data from raster object of class 'asc' (this and the adehabitat package), 'RasterLayer' (raster package) or 'SpatialGridDataFrame' (sp package) at specified locations. This represents a faster version of 'join.asc' of the adehabitat package that assumes all locations are within the map extents.

Note: there is no interpolation done here. The values reported are simply the values of the raster cell the point falls into.

Usage

1
2
## S3 method for class 'data'
extract(pts, x)

Arguments

pts

a two-column data frame or matrix with the x and y coordinates of the locations of interest.

x

a raster matrix of class 'asc' (this and the adehabitat package), 'RasterLayer' (raster package) or 'SpatialGridDataFrame' (sp package)

Details

Implements a faster version of 'join.asc' from the adehabitat package.

NOTE: this assumes all locations are within the extent of the raster map. Values outside the extent will be given a value of NA.

Value

Returns a vector equal in length to the number of locations in pnts.

Author(s)

Jeremy VanDerWal jjvanderwal@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#create a simple object of class 'asc'
tasc = as.asc(matrix(1:50,nr=50,nc=50)); print(tasc)

#define some point locations
points = data.frame(x=runif(25,1,50),y=runif(25,1,50))

#extract the data
points$values = extract.data(points,tasc)

#show the data
print(points)


Search within the SDMTools package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.