asp_ratio: Compute aspect ratio for spatial input

View source: R/asp_ratio.R

asp_ratioR Documentation

Compute aspect ratio for spatial input

Description

Computes the aspect ratio as width divided by height, or columns divided by 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

A numeric scalar giving 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 21, 2026, 5:07 p.m.