R: Spatial Join of Points with Raster Grids - replace data

put.data {SDMTools} | R Documentation

## Spatial Join of Points with Raster Grids - replace data

### Description

`put.data` replaces data in raster object of class 'asc' (this and adehabitat package) at specified locations.
Note: there is no interpolation done here. The values given replace the values of the raster cell the point falls into.

### Usage

    put.data(pts, x)

### Arguments

`pts` | a three-column data frame or matrix with the x and y coordinates of the locations of interest and the third column being the z values to put in the ascii grid file.
`x` | a raster matrix of class 'asc' (this and the adehabitat 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 raster matrix of class 'asc' equal in size to input 'x'.

### Author(s)

Jeremy VanDerWal jjvanderwal@gmail.com

### Examples

    #create a simple object of class 'asc'
    tasc = as.asc(matrix(1:50,nr=50,nc=50)); print(tasc)
    ## Not run: image(tasc)

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

    #put the new data
    tasc = put.data(points,tasc)

    #show the data
    ## Not run: image(tasc)

[Package SDMTools version 1.1-221.2 Index]