Learn R Programming

ursa (version 3.9.4)

read_gdal: Read GDAL supported raster files.

Description

read_gdal creates ursaRaster object from GDAL supported raster files using functions from rgdal packages.

Usage

read_gdal(fname, resetGrid = TRUE, band = NULL, engine = c("native", "rgdal", "sf"),
          verbose = FALSE, ...)

ursa_read(fname, verbose = FALSE)

Arguments

fname

Character. GDAL supported raster file name.

resetGrid

Logical. If TRUE then new sessional grid is based on opened raster image. Default is TRUE

band

Character (regular expression) or integer.

engine

Character. Functionality of which package is used for reading data. If partial data (band is not NULL), then engine is "rgdal". If value is "sf" and no partial data reading then sf::gdal_read() is used before importing. If value is "rgdal" or partial data reading, then interaction with rgdal is used. Currently, "native" is similar to "rgdal", but in next versions behaviour can be changed to engine selection depends on which namespace has already loaded or has suggested package sf been installed.

verbose

Logical. Value TRUE may provide some additional information on console. Default is FALSE.

Ignored.

Value

Object of class ursaRaster.

Details

ursa_read is simplified implementation of gdal_read.

The composite GDAL formats (e.g., NetCDF: Network Common Data Format, HDF5: Hierarchical Data Format Release 5) are likely unsupported.

read_gdal uses functions from rgdal:

Category names and color tables are supported.

See Also

rgdal::GDALinfo() for supported GDAL raster formats

as.ursa is an alternative call for GDAL raster files import.

Examples

Run this code
# NOT RUN {
session_grid(NULL)

rgdal::gdalDrivers()
Fin1 <- system.file("pictures/Rlogo.jpg",package="rgdal")
a1 <- read_gdal(Fin1)
print(a1)
display(a1)

Fin2 <- system.file("pictures/test_envi_class.envi",package="rgdal")
b1 <- read_gdal(Fin2)
b2 <- read_envi(Fin2,resetGrid=TRUE)
print(identical(ursa_grid(b1),ursa_grid(b2)))
print(identical(ursa_value(b1),ursa_value(b2)))
print(identical(ursa_colortable(b1),ursa_colortable(b2)))
print(ursa_colortable(b1))
print(as.table(b1))
display(b1,detail="l")
# }

Run the code above in your browser using DataLab