Learn R Programming

raincpc (version 1.1.0)

sdm_extract_data: Spatial Join of Points with Raster Grids

Description

Spatial Join of Points with Raster Grids

Usage

sdm_extract_data(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)

Value

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

Details

sdm_extract_data is an adaptation of extract.data from SDMTools; extracts data from raster object of class 'asc' or RasterLayer' (raster package) at specified locations.

Examples

Run this code
# NOT RUN {
#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 = sdm_extract_data(points, tasc)

#show the data
print(points)
# }

Run the code above in your browser using DataLab