Unlike grd_subset(), which subsets like a matrix, grd_extract() returns values.

grd_extract(grid, i = NULL, j = NULL)

grd_extract_nearest(grid, point, out_of_bounds = c("censor", "squish"))

grd_data_extract(grid_data, i = NULL, j = NULL)

Arguments

grid

A grd_xy(), grd_rct(), or other object implementing grd_*() methods.

i, j

Index values as in grd_subset() except recycled to a common size.

point

A handleable of points.

out_of_bounds

One of 'keep', 'censor', 'discard', or 'squish'

grid_data

The data member of a grd(). This is typically an array but can also be an S3 object with an array-like subset method. The native raster is special-cased as its subset method requires non-standard handling.

Value

A matrix or vector with two fewer dimensions than the input.