Subset or otherwise make available only the data that is within the provided bounds. Accepted bounds types depends on the data.
A related lower-level function is getTile() which handles data/tile*
interactions and bound info collection. getTile() calls this generic
for its data selection capabilities.
Usage
# S4 method for class 'SpatRaster,numeric'
getBoundedData(x, bound, extend = FALSE, fill = NA)
# S4 method for class 'SpatRaster,SpatExtent'
getBoundedData(x, bound, extend = FALSE, fill = NA)
# S4 method for class 'SpatVectorProxy,SpatExtent'
getBoundedData(x, bound)Bounds types
Depending on the method, different bound types are used. Current expected patterns are:
numericof length 4 (xmin, xmax, ymin, ymax)SpatExtent
SpatRaster snapping
getBoundedData() is implemented for SpatRaster, SpatExtent using
terra::window(). This uses terra's default snapping behavior (equivalent to
snap = "near" in terra::crop()), with no way to set another strategy.
For more precise boundary control:
Use pixel-based indexing via the
SpatRaster,numericmethodUse
pixelTilePlan()for exact pixel-level tilingAdd padding with
tiles + pad_valueto ensure spatial contextUse
terra::crop()directly if you needsnap = "out"orsnap = "in"
Boundary Inclusivity
Adjacent tiles share exact boundaries. Since {tilework} does not know the
format or representation of the underlying data, it does not enforce whether
those boundaries are inclusive or exclusive. It is up to the
getBoundedData() implementation to decide how features on shared edges are
handled.
The existing {terra} methods do not implement inclusive/exclusive boundary
control because raster pixel snapping and padding make exact boundary
behavior largely irrelevant for that format. For point or tabular data,
features on a shared boundary may appear in multiple tiles unless the
implementation applies its own filtering (e.g. >= vs > comparisons).
The tile's grid position can be passed via get_params from getTile() to
inform which edges are interior.
See also
Other tile processing:
getTile(),
tileApply(),
tileApply-group,
tileApply-iterator,
tileApply-plan

