extract_array: extract_array

Description Usage Arguments

View source: R/extract_array.R

Description

This function extracts the values from an array for a set of spatial coordinates. The coordinates must be in the same projection as the raster layers used to create the array.

Note: currently this function works on only one layer at a time. To extract the value from different layers at the same coordinates this function will need to be used in a loop, changing *third_dim_ind* for each iteration to move through the array temporally. This functionality will be updated in future versions.

Usage

1
extract_array(array, extent, coords, third_dim_ind, resolution)

Arguments

array

an array with dimensions 1 and 2 being the y and x values (respectively) of the rasters layers, the 3rd dimension is the multiple layers for same spatial extent (i.e. multiple layers of the same area through time)

extent

an extent object. contains xmin, xmax, ymin, ymax of the raster layers used to make the array

coords

a 2 column matrix/dataframe with the x and y coordinates in same projection as extent

third_dim_ind

index of which layer to be used, i.e. third dimension

resolution

a vector with 2 values indicating the x and y resolution of each raster cell


hmcdevitt/spExtract documentation built on July 13, 2020, 2:11 p.m.