Create a raster that can be used to define the resolution, origin, and projection to be employed for all least-cost analyses. If a source DEM has such properties you may use that.

fix_z(proj, res = 5, dx = 0, dy = 0)

Arguments

proj

A crs object or character string containing projection information. Should be conformal and in meters.

res

A numeric of length one or two nrepresenting the spatial resolution. Default is 5.

dx

The horizontal offset from the origin (see origin). Default is 0 (this does not correspond to an origin of zero however).

dy

The vertical offset from the origin (see origin). Default is 0 (this does not correspond to an origin of zero however).

Value

A SpatRaster object consisting of four cells, with resolution res and the origin at x = nx and y = ny.

Examples

projection <- "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +datum=WGS84"
z_fix <- fix_z(res = 2, proj = projection)