conn.read_gdal: Read GDAL supported raster files.

read_gdalR Documentation

Read GDAL supported raster files.

Description

read_gdal creates ursaRaster object from GDAL supported raster files using functions from packages with low-level raster reading.

Usage

read_gdal(fname, resetGrid = TRUE, band = NULL,
          engine = c("native", "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. This is experimental list, which future depends on evolution of reviewed packages and their availability for partial reading of multiband rasters.

verbose

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

...

Ignored.

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 other other packages. It's a wrapper.

Category names and color tables are supported.

Value

Object of class ursaRaster.

Author(s)

Nikita Platonov platonov@sevin.ru

See Also

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

Examples

session_grid(NULL)

# rgdal::gdalDrivers()
if (requireNamespace("sf"))
   print(sf::st_drivers())
if (file.exists(Fin1 <- system.file("gdal/gdalicon.png",package="sf"))) {
   a1 <- read_gdal(Fin1)
   print(a1)
   display(a1)
}
Fin2 <- tempfile(fileext=".")
a <- ursa_dummy(1,resetGrid=TRUE)
b <- colorize(a[a>91],stretch="equal",name=format(Sys.Date()+seq(0,6),"%A %d"))
write_envi(b,Fin2)
b1 <- read_gdal(Fin2)
b2 <- read_envi(Fin2,resetGrid=TRUE)
envi_remove(Fin2)
print(c('same colortable?'=identical(ursa_colortable(b1),ursa_colortable(b2))))
print(ursa_colortable(b1))
print(as.table(b1))
print(c('same values?'=identical(ursa_value(b1),ursa_value(b2))))
print(c('same grid?'=identical(ursa_grid(b1),ursa_grid(b2))))
if (requireNamespace("sf")) {
   p1 <- sf::st_crs(ursa_crs(b1))
   p2 <- sf::st_crs(ursa_crs(b2))
   print(c('same proj4string for CRS?'=identical(p1$proj4string,p2$proj4string)))
   print(c('same WKT for CRS?'=identical(p1$Wkt,p2$Wkt)))
   ursa_crs(b1) <- ursa_crs(b2)
   print(c('after same CRS, same grid?'=identical(ursa_grid(b1),ursa_grid(b2))))
}
display(b1,detail="l")

nplatonov/ursa documentation built on May 8, 2024, 6:02 p.m.