longLatRasters: Generate rasters with cell values equal to cell longitude or...

View source: R/longLatRasters.r

longLatRastersR Documentation

Generate rasters with cell values equal to cell longitude or latitude

Description

This function generates a raster stack with two rasters, one with cell values equal to the cell's longitude and the other with cell values equal to cthe cell's latitude.

Usage

longLatRasters(x, m = NULL, filePath = NULL, ...)

Arguments

x

Raster* object. The output will have the same resolution, extent, and coordinate projection system as x.

m

Logical or raster* object. If TRUE then the output rasters will have NAs placed in cells where NAs exist in x (or the first layer in x if x is a raster stack or brick. If FALSE then longitude and latitude will be calcualted for all cells. If m is a raster then values in the output will be NA wherever they are NA in m.

filePath

String or NULL. If a string, then this is the path (not including file name) to which to write the raster stack with longitude/latitude rasters. If NULL then no file is written.

...

Arguments to pass to writeRaster (if filePath is not NULL).

Value

Object of class RasterStack.

Examples

## Not run: 
x <- raster::raster() # raster with 1 deg resolution and extent equal to entire world
ll <- longLatRasters(x)
plot(ll)

## End(Not run)

adamlilith/enmSdm documentation built on Jan. 6, 2023, 11 a.m.