conn.open_gdal: Open GDAL file

Description Usage Arguments Details Value Author(s) See Also Examples

Description

open_gdal creates object of ursaRaster class, and prepares connections for data reading.

Usage

1
2
3
open_gdal(fname, verbose = FALSE)

ursa_open(fname, verbose = FALSE)

Arguments

fname

Character. Filename; full-name or short-name.

verbose

Logical. verbose=TRUE provides some additional information on console. Default is FALSE.

Details

ursa_open is a synonym to open_gdal. Generally, both function names are abridged version of ursa_open_dgal.

open_gdal doesn't read data. Data can be read later using Extract operator [.

If argument fname is ENVI .hdr Labelled Raster then either open_gdal or open_envi can be used. The former provides external implementation for data reading via GDAL in rgdal package.

Value

Returns object of class ursaRaster. Values are not in memory.

Author(s)

Nikita Platonov platonov@sevin.ru

See Also

close, open_envi, read_gdal.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
session_grid(NULL)
fname1 <- system.file("pictures/cea.tif",package="rgdal")
message(fname1)
a1 <- open_gdal(fname1)
print(a1)
print(a1[])
close(a1)
fname2 <- system.file("pictures/test_envi_class.envi",package="rgdal")
message(fname2)
b1 <- open_gdal(fname2)
b2 <- open_envi(fname2)
print(b1)
print(b2)
print(c('The same grid?'=identical(ursa_grid(b1),ursa_grid(b2))
       ,'The same data?'=identical(ursa_value(b1[]),ursa_value(b2[]))))
close(b1,b2)

Example output

/usr/lib/R/site-library/rgdal/pictures/cea.tif
List of 12
 $ columns : int 514
 $ rows    : int 515
 $ resx    : num 60
 $ resy    : num 60
 $ minx    : num -28493
 $ maxx    : num 2358
 $ miny    : num 4224973
 $ maxy    : num 4255885
 $ crs     : chr "+proj=cea +lat_ts=33.75 +lon_0=-117.333333333333 +x_0=0 +y_0=0 +datum=NAD27 +units=m +no_defs"
  ..- attr(*, "comment")= chr "PROJCRS[\"unnamed\",\n    BASEGEOGCRS[\"NAD27\",\n        DATUM[\"North American Datum 1927\",\n            ELL"| __truncated__
 $ retina  : logi NA
 $ mode    : chr [1:2] "raw" "logical"
 $ bandname: chr "Band 1"
 - attr(*, "class")= chr "ursaMetadata"
NULL
      name    mean      sd      sum min max      n nNA
[1] Band 1 103.149 58.8975 27304701   0 255 264710   0
/usr/lib/R/site-library/rgdal/pictures/test_envi_class.envi
Warning message:
In file("/usr/lib/R/site-library/rgdal/pictures/test_envi_class.envi",  :
  cannot open file '/usr/lib/R/site-library/rgdal/pictures/test_envi_class.envi': Permission denied
List of 13
 $ columns   : int 30
 $ rows      : int 30
 $ resx      : num 0.5
 $ resy      : num 0.5
 $ minx      : num -100
 $ maxx      : num -85
 $ miny      : num 48.1
 $ maxy      : num 63.1
 $ crs       : chr "+proj=longlat +datum=WGS84 +no_defs"
  ..- attr(*, "comment")= chr "GEOGCRS[\"WGS 84\",\n    DATUM[\"World Geodetic System 1984\",\n        ELLIPSOID[\"WGS 84\",6378137,298.257223"| __truncated__
 $ retina    : logi NA
 $ mode      : chr [1:2] "raw" "logical"
 $ bandname  : chr "Band 1"
 $ colortable: 'ursaColorTable' Named chr [1:11] "#000000" "#FF0000" "#FF9900" "#CCFF00" ...
  ..- attr(*, "names")= chr [1:11] "Unclassified" "temperature_min" "temperature_max" "temperature_var" ...
 - attr(*, "class")= chr "ursaMetadata"
NULL
List of 15
 $ columns   : int 30
 $ rows      : int 30
 $ resx      : num 0.5
 $ resy      : num 0.5
 $ minx      : num -100
 $ maxx      : num -85
 $ miny      : num 48.1
 $ maxy      : num 63.1
 $ crs       : chr "+proj=longlat +datum=WGS84 +no_defs"
  ..- attr(*, "comment")= chr "GEOGCRS[\"WGS 84\",\n    DATUM[\"World Geodetic System 1984\",\n        ELLIPSOID[\"WGS 84\",6378137,298.257223"| __truncated__
 $ retina    : logi NA
 $ datatype  : int 2
 $ interleave: chr "bsq"
 $ mode      : chr [1:2] "integer" "logical"
 $ bandname  : chr "Band 1"
 $ colortable: 'ursaColorTable' Named chr [1:11] "#000000" "#FF0000" "#FF9900" "#CCFF00" ...
  ..- attr(*, "names")= chr [1:11] "Unclassified" "temperature_min" "temperature_max" "temperature_var" ...
 - attr(*, "class")= chr "ursaMetadata"
NULL
The same grid? The same data? 
          TRUE           TRUE 

ursa documentation built on Feb. 26, 2020, 3:01 p.m.