ascGridResample: Crops, resamples and registers an input ASCII Grid raster to...

Description Usage Arguments Details Value Author(s)

View source: R/ascGridResample.r

Description

This function is useful for generating a set of precisely matching ASCII Grid raster files, for input to software such as MaxEnt. The function takes an input raster to adjust, a template raster (which must be an ASCII Grid .asc file), and a filename for output, and crops, resamples and aligns the input raster to exactly match the template.

Usage

1
ascGridResample(x, template, filename = "")

Arguments

x

The input raster to be cropped. Either a filename, or a RasterLayer object.

template

The template raster. Either a filename or a RasterLayer object. Must be an ASCII Grid (.asc) file.

filename

The filename the output raster will be written to.

Details

The standard crop/extent functions in the raster package seem to have issues with coordinate precision, so software such as MaxEnt often complains of projection errors even if the number of cells in the raster input files are the same. In order to overcome this, the function manually copies the header data from the template file to the output file. All rasters should be in WGS84 projection.

Value

The function writes the output ASCII Grid raster to disk, and returns the filename.

Author(s)

Grant Williamson


ozjimbob/ecbtools documentation built on Jan. 18, 2021, 7:39 p.m.