asp_ratio: Compute aspect ratio of an object

View source: R/asp_ratio.R

asp_ratioR Documentation

Compute aspect ratio of an object

Description

Helper function. Ratio is computed as width/height (or col/rows).

Usage

asp_ratio(x)

Arguments

x

A SpatRaster object, an sf/sfc object or a numeric vector of length 4 with coordinates c(xmin, ymin, xmax, ymax), as created by sf::st_bbox().

Value

The aspect ratio

Examples


library(terra)

x <- rast(system.file("tiff/elev.tiff", package = "rasterpic"))
plot(x)
asp_ratio(x)


rasterpic documentation built on May 29, 2024, 2:36 a.m.