vapour_create: Create raster file

View source: R/00_read_block.R

vapour_createR Documentation

Create raster file

Description

This is in an incomplete interface to raster writing, for exploring.

Usage

vapour_create(
  filename,
  driver = "GTiff",
  extent = c(-180, 180, -90, 90),
  dimension = c(2048, 1024),
  projection = "OGC:CRS84",
  n_bands = 1L,
  overwrite = FALSE
)

Arguments

filename

filename/path to create

driver

GDAL driver to use (GTiff is default, and recommended)

extent

xmin,xmax,ymin,ymax 4-element vector

dimension

dimension of the output, X * Y

projection

projection of the output, best to use a full WKT but any string accepted

n_bands

number of bands in the output, default is 1

overwrite

not TRUE by default

Details

If GeoTIFF is used (driver = "GTiff", recommended) then the output is tiled 512x512, and has DEFLATE compression, and is sparse when created (no values are initiated, so the file is tiny).

Note that there is no restriction on where you can read or write from, the responsibility is yours. In future we will allow control of output tiling and data type etc.

Value

the file path that was created

Examples

tfile <- tempfile(fileext = ".tif")
if (!file.exists(tfile)) {
 vapour_create(tfile, extent = c(-1, 1, -1, 1) * 1e6, 
                     dimension = c(128, 128), 
                     projection = "+proj=laea")
 file.remove(tfile)
}

vapour documentation built on April 11, 2023, 5:59 p.m.