Description Usage Arguments Details Value Author(s) See Also Examples
This function creates an arbitrarily large raster as a flat binary file with (optionally) a proper header for use with other functions. This should create the blank files very quickly, as it is using some OS tricks to carve out a block of space rather than writing a bunch of 0s to disk sequentially.
1 2 3 4 5 |
filename |
Character. The output base filename of the blank file. Will use tempfile() if nothing is provided. |
format |
Character. Output format. Currently only supports "raster". |
datatype |
Character. Output number type. See ?dataType. Default is "FLT8S". |
bandorder |
Character. Output band interleave. Currently only supports "BSQ". |
nrow |
Numeric. Number of rows of the output raster. Defaults to nrow(reference_raster). |
ncol |
Numeric. Number of columns of the output raster. Defaults to ncol(reference_raster). |
nlayers |
Numeric. Number of layers of the output raster Defaults to nlayer(reference_raster). |
create_header |
Logical. Create a properly formatted header for the blank file? |
reference_raster |
Raster*. Reference raster to derive other information, e.g. resolution, projection, datum. |
return_filename |
Logical. Return filename of the binary file (if TRUE, default) or the Raster* itself (if FALSE). |
additional_header |
Character. Create additional output headers for use with other GIS systems (see |
overwrite |
Logical. Overwrite an existing file with the same name? |
verbose |
Logical. Enable verbose execution? Default is FALSE. |
create_blank_raster is designed to quickly create a binary file of the appropriate size using tricks with seek()/writeBin(). A large file can be created in a fraction of a second using this function. This file could, for example, be used with mmap to realize asynchronous or, OS permitting, parallel writes to a single file. Note that setMinMax are NOT performed on the output file (to save time), so on some systems you may see a warning.
Binary files of this type are used by a number of raster formats, including raster and ENVI.
A character vector (return_filename==TRUE) or as Raster* object (return_filename==TRUE)
Jonathan A. Greenberg
1 2 3 4 5 6 7 8 | ## Not run:
tahoe_highrez <- brick(system.file("external/tahoe_highrez.tif", package="spatial.tools"))
test_blank_file <- create_blank_raster(reference_raster=tahoe_highrez)
file.info(test_blank_file)
test_blank_raster <- create_blank_raster(reference_raster=tahoe_highrez,return_filename=FALSE)
test_blank_raster
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.