gdalio_data: Read GDAL raster numeric data

View source: R/gdalio.R

gdalio_dataR Documentation

Read GDAL raster numeric data

Description

Data may be one band (the default, first band) or many.

Usage

gdalio_graphics(dsn, bands = 1:3, ...)

gdalio_matrix(dsn, ...)

gdalio_array(dsn, ...)

gdalio_image(dsn, ..., extent = NULL, dimension = NULL, projection = NULL)

gdalio_data(dsn, ..., bands = 1L)

gdalio_graphics(dsn, bands = 1:3, ...)

gdalio_matrix(dsn, ...)

gdalio_array(dsn, ...)

Arguments

dsn

character string, raster source understood by GDAL

bands

default 1L, but can be more, duplicated in different order, or 'NULL' for all

...

arguments passed to 'vapour::vapour_warp_raster'

Details

gdalio_data() returns a list of vectors, gdalio_matrix() and gdalio_array() and gdalio_graphics() return a matrix, array, matrix of the necessary shape, as used by image() and plot().

The matrix of hex values returned by gdalio_graphics() cannot really be placed on a spatial plot window without a lot of extra work, but it's good for fast visuals to 'plot()' the output. We can write helpers to plot this thing better but WIP atm.

Value

list of numeric vectors

Examples

## Not run: 
 f <- system.file("extdata/sst.tif", package = "vapour", mustWork = TRUE)

 g <- list(extent = c(130, 160, -60, -30), dimension = c(180, 100),
    projection = "+proj=longlat")
 gdalio_set_default_grid(g)
 v <- gdalio_data(f, band_output_type = "int")
 image(seq(130, 160, length.out = 181), seq(-60, -30, length.out = 101),
    matrix(v[[1]], g$dimension[1])[,g$dimension[2]:1], asp = 1.5)

## End(Not run)

hypertidy/gdalio documentation built on June 15, 2022, 6:45 p.m.