snapToEdge: Function to snap a coordinate to the edge of a cell.

View source: R/snapToEdge.R

snapToEdgeR Documentation

Function to snap a coordinate to the edge of a cell.

Description

This function is primarily for internal use by makeReference()

Usage

snapToEdge(x, cellsize, up = TRUE, offset = 0)

Arguments

x

a vector of coordinates (either x or y component) to be snapped to a cell boundary

cellsize

the cellsize of the grid being snapped.

up

if TRUE then the number is snapped up to the nearest cell boundary if FALSE it is snapped down.

offset

the distance up from the origin to the first cell boundary.

Details

If offset is 0 it will snap to cells aligned with the origin, otherwise offset should be the positive offset from the origin to the first cell boundary.

Value

a vector of number close to x that fall on cell boundaries if up is TRUE they will be equal to or higher than corresponding values in x if FALSE they will be the equal or lower.


ethanplunkett/rasterPrep documentation built on Sept. 17, 2024, 1:05 p.m.