buffer_extent {spex}R Documentation

Whole grain buffers

Description

Ensure a raster extent aligns to a clean divisor.

Usage

buffer_extent(e1, e2)

Arguments

e1

input extent

e2

grain size

Details

This function is used to generate extents that have tidy boundaries, i.e. extents that align to a clean whole number like "10000".

(We can't use the S4 group generic because raster has set that specifically for use with '+' and '-'.)

Examples

library(raster)
buffer_extent(extent(0.1, 2.2, 0, 3), 2)

p <- par(xpd = NA) 
plot(lux)
plot(extent(lux), lty = 2, add = TRUE, col = "grey")
plot(buffer_extent(lux, 0.1), add = TRUE)
abline(v = c(5.7, 6.6), h = c(49.4, 50.2))
title("boundaries on clean alignment to 0.1")
par(p)

[Package spex version 0.7.1 Index]