R/mosaic_terrain_tiles.R
mosaic_terrain_tiles.RdJoins file-backed single-band tiles in source priority order, optionally resampling differing source grids to a same-CRS output template.
mosaic_terrain_tiles(
sources,
filename,
overlap,
extent = NULL,
template = NULL
)Ordered paths to compatible elevation rasters. The caller must establish common acquisition, elevation units and vertical reference.
New output GeoTIFF path. Existing files are never overwritten.
Either `"first"` or `"last"` valid source value in overlap cells.
Optional numeric `c(xmin, xmax, ymin, ymax)` window in the source CRS. Native terra crop snaps outward to source cells before assembly. This is suitable for aligned, non-interpolated processing. Without a template, callers preserve support for any later interpolation; NULL uses full tiles. With a template, extent restricts its grid and source support is automatic.
Optional single-band raster path defining the output grid in the same horizontal CRS. Bilinear resampling follows source-grid assembly; template values are ignored. With extent, snap the target window outward to template cells. Source reads retain a two-cell interpolation halo at the larger of source and target spacing. Apply the analysis mask afterwards.
A compact list describing the output path, source order, grid and processing method. This is not scientific acceptance or a Survey Event product.
Inputs share full CRS and elevation units. Without a template they must also share resolution and alignment. With a template, consecutive same-grid tiles are joined before bilinear resampling to the exact Event grid. Resampled runs are merged in source order with first/last-valid precedence and no additional interpolation. NoData follows native terra semantics; no blending, gap filling or reference conversion is added. Each run uses the full target template to keep native interpolation edge weights consistent; source reads remain windowed with interpolation support. Output is file-backed Float32 with lossless compression. Use small windows of actual source DEMs for development. No processing-size limits are imposed. Applications should invoke it in a background worker.