radiusExtractXY: Extract raster data within a window

Description Usage Arguments Details Value Creation notes

View source: R/rasterWindowExtract.R

Description

Raster package was missing a function to easily extract data within a window. This is accomplished by using a radius instead of a true window. These are wrappers for the windowExtract() function that does the heavy lifting.

Usage

1
2
3
radiusExtractXY(lon, lat, ras, radius = 1)

radiusExtractData(cellID, rasData, radius = 1)

Arguments

lon, lat

Input locations that you are extracting from.

ras

raster* object that the data is being pulled from

radius

numeric. radius used to define extractWindow

rasData

data.frame object that contains the correct headers ('x', 'y', (valcolumns)). Will need to seperate out this function and create a class for it.

Details

radiusExtractXY() extracts data directly from a raster using lat long coordinates.

radiusExtractData() is an optomized version that works better if the raster you are extracting from never changes and you are using it for multiple points. It uses an input data.frame of the raster values that you can create once and then extracts data by cellID.

Value

Returns a data.frame with the raster values extracted at the current radius.

Creation notes

First created on 2019-Mar-6 in the Lab4inR.R and select.window.R scripts in my IBM class folder of the purdueResearch git. They were developed using base code found at http://rfunctions.blogspot.com/2017/08/extracting-data-from-rasters-using.html?view=classic. It uses another function windowExtract() to do the main work.


jacpete/jpfxns2 documentation built on May 10, 2020, 9:15 p.m.