conn.create_any: Create ENVI or GDAL files on disk

create_enviR Documentation

Create ENVI or GDAL files on disk

Description

create_envi creates ENVI binary and header files on disk. ENVI binary file is filled by blank (zero) values.
create_gdal is just an entry for GDAL wrapper; currently via internal ENVI implementation.

Usage

create_gdal(x, ...)

create_envi(x, ...)

Arguments

x

Filename, or any refenerce object to help assign properties of new ENVI file. Can be missed.

...

Use name = value sequence. Properties of new ENVI file are extracted from keywords in 'name' and data types of 'value'.

Details

Prior ursa version < 3.10, create_gdal() used classes and methods from package rgdal. Currenty, alternatives are not found for complete replacement of rgdal. At the present, ENVI binary and header are created, firstly, and close() transforms to desired GDAL format, finally.

create_envi and create_gdal use parameters of grid (boundary box, cell size, projection) from reference object of class ursaRaster in argument x or calls session_grid. You may specify values of GDAL or ENVI binary file later using [<-. If x is object of class ursaRaster then metadata parameters (interleave, data type, ignore value, etc) are inherited.

Keywords:

  • fname - character. File name for created GDAL or ENVI file.

    For create_envi only: If compress of connections is not specified then example for “fileout” file name:

    • "fileout" - If external 'gzip' is found then "fileout.envigz" is created else "fileout.envi"

    • "fileout.envi" - "fileout.envi" is created without any compression.

    • "fileout." - "fileout" is created without any compression.

    • "fileout.bin" - "fileout.bin" is created without any compression.

    • "fileout.img" - "fileout.img" is created without any compression.

    • "fileout.dat" - "fileout.dat" is created without any compression.

  • driver - character. For create_gdal only. Which GDAL driver is used.

  • layername - character of length>=1. Layernames (‘Band name’ in ENVI header file)

  • bandname - character of length>=1. Layernames (‘Band name’ in ENVI header file)

  • name - character of length>=1. Layernames (‘Band name’ in ENVI header file)

  • nodata - integer or numeric. Value in GDAL or ENVI binary file, which is interpretted as NA in R

  • ignore - integer or numeric. Value in GDAL or ENVI binary file, which is interpretted as NA in R

  • ignorevalue - integer or numeric. Value in GDAL or ENVI binary file, which is interpretted as NA in R

  • bg - integer or numeric. Value in GDAL or ENVI binary file, which is interpretted as NA in R

  • connection - character. For create_envi only. connections for ENVI binary file.

    Valid values are:

    • "gz" - connection is "gzfile"

    • "bz" - connection is "bzfile"

    • "xz" - connection is "xzfile"

    • "file" - connection is "file"

  • interleave - character. Interleave. Valid values are "bsq", "bil", "bip". For create_gdal and driver="GTiff" valid values are "bsq" and "bil".

  • datatype - character or integer (numeric). Data type.

    Valid values are:

    • 1, "byte", "Byte", "UInt8" = Byte: 8-bit unsigned integer

    • 2, "integer", "Int16" = Integer: 16-bit signed integer

    • 3, "Int32" = Long: 32-bit signed integer

    • 4, "real", "float", "Float32" = Floating-point: 32-bit single-precision

    • 5, "Float64" = Double-precision: 64-bit double-precision floating-point

    • 11, "UInt8" = Byte: 8-bit signed integer. Not in specification. Only for use with this package.

    • 12, "UInt16" = Integer: 16-bit unsigned integer

    • 13, "UInt32" = Long: 32-bit unsigned integer

    Specification https://envi.geoscene.cn/help/Subsystems/envi/Content/ExploreImagery/ENVIHeaderFiles.htm is used.

  • byteorder - numeric (integer). Byte order.

  • bands - numeric( integer). Number of bands/layers

  • nband - numeric( integer). Number of bands/layers

  • nlayer - numeric( integer). Number of bands/layers

  • layers - numeric( integer). Number of bands/layers

  • compress - integer (numeric) or logical. For create_envi only. Should ENVI binary file be compressed after closing connection.

  • wkt - integer (numeric) or logical. Forced adding ‘coordinate system string’ to ENVI header file

  • ext - character. For create_envi only. Extension of ENVI binary file. For extensions not in c("envi","bin","dat","img") list

If file name is unknown, then random file name is used with informing via message().

Value

Object of class ursaRaster with opened connection of GDAL or ENVI binary file.

Author(s)

Nikita Platonov platonov@sevin.ru

See Also

ursa_new creates object of class ursaRaster in memory and allows to assign values at once.

Use session_grid to check or specify parameters of grid before calling create_envi.

Use [<- to assign values to ENVI binary file after calling create_envi.

Use close (or close_envi) to close connections.

Examples

session_grid(NULL)
a <- create_envi()
fname <- a$con$fname
dir(pattern=basename(envi_list(fname)))
close(a)
invisible(envi_remove(fname))

a <- create_envi("exam1",layername=paste("Band",1:5)
                ,ignorevalue=99,datatype="Int16",interleave="bil")
ursa_info(a)
print(a[])
close(a)
invisible(envi_remove("exam1"))

ursa documentation built on Sept. 30, 2024, 9:35 a.m.