merge_rasters: Merge multiple raster files into a single raster

Description Usage Arguments Value See Also Examples

View source: R/merge_rasters.R

Description

Some functions like [get_tiles] return multiple separate files when it can be useful to have a single larger raster instead. This function is a thin wrapper over [sf::gdal_utils(util = "warp")], making it easy to collapse those multiple raster files into a single TIFF.

Usage

1
2
3
4
5
merge_rasters(
  input_rasters,
  output_raster = tempfile(fileext = ".tif"),
  options = character(0)
)

Arguments

input_rasters

A character vector containing the file paths to the georeferenced rasters you want to use.

output_raster

The file path to save the merged georeferenced raster to.

options

Optionally, a character vector of options to be passed directly to [sf::gdal_utils].

Value

'output_raster', invisibly.

See Also

Other data manipulation functions: combine_overlays(), georeference_overlay(), raster_to_raw_tiles(), vector_to_overlay()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
simulated_data <- data.frame(
lat = c(44.10379, 44.17573),
lng = c(-74.01177, -73.91171)
)

simulated_data <- sf::st_as_sf(simulated_data, coords = c("lng", "lat"))

img_files <- get_tiles(simulated_data)
merge_rasters(img_files[[1]])


## End(Not run)

terrainr documentation built on Feb. 23, 2021, 9:06 a.m.