getDistortion: Get geodesic distortion for rasters

View source: R/getDistortion.R

getDistortionR Documentation

Get geodesic distortion for rasters

Description

Calculate the geodesic distortion on a raster

Usage

getDistortion(z)

Arguments

z

An input SpatRaster with a known projection

Value

A SpatRaster with three layers: (1) 'lx' with the horizontal pixel size

(2) 'ly' with the vertical pixel size

(3) 'A' with the pixel area

Examples

# Generate dummy dem, assign it a projection
n <- 5
dem <- expand.grid(list(x = 1:(n * 100),
                        y = 1:(n * 100))) / 100
dem <- as.data.table(dem)
dem[, z := 250 * exp(-(x - n/2)^2) + 
      250 * exp(-(y - n/2)^2)]
dem <- rast(dem)
ext(dem) <- c(10000, 20000, 30000, 40000)
crs(dem) <- "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +datum=WGS84"

# Get the geodesic distorsion
distort <- getDistortion(dem)

andresgmejiar/lbmech documentation built on Feb. 2, 2025, 12:37 a.m.