Learn R Programming

geoviz (version 0.2.2)

mosaic_files: Stitches together files into a single raster Requires a target directory of files that can be read with raster::raster(), e.g. .asc files, or a directory of .zip files containing these files

Description

Stitches together files into a single raster Requires a target directory of files that can be read with raster::raster(), e.g. .asc files, or a directory of .zip files containing these files

Usage

mosaic_files(
  path,
  extract_zip = FALSE,
  file_match = ".*.asc",
  zip_file_match = ".*.zip",
  raster_output_file = "mosaic_out.raster",
  file_crs = NULL,
  raster_todisk = FALSE
)

Arguments

path

path to files that are to be stitched together

extract_zip

FALSE to target .asc files, TRUE if your .asc files are zipped.

file_match

regex pattern to match .asc files, either in path or in zip files.

zip_file_match

regex pattern to match .zip files

raster_output_file

raster file to be created (will overwrite existing files)

file_crs

projection string of the input files. Output will always be WGS84.

raster_todisk

Setting TRUE will set rasterOptions(todisk=TRUE), which can help with memory issues.

Value

TRUE

Examples

Run this code
# NOT RUN {
# Merges two small example .asc files of LIDAR data
# from https://environment.data.gov.uk (open government licence)

path_to_files <- system.file("extdata/example_asc", package = "geoviz")

path_to_output <- tempdir()

mosaic_files(path_to_files,
             raster_output_file = paste0(path_to_output, '/mosaic_out.raster', sep = ''),
             extract_zip = TRUE, file_crs = "+init=epsg:27700")

raster_mosaic <- raster::raster(paste0(path_to_output, '/mosaic_out.gri', sep = ''))
# }

Run the code above in your browser using DataLab