plot_raster: Plot GDAL matrix.

Description Usage Arguments Details Examples

View source: R/plot_raster.R

Description

Plot a matrix directly read via GDAL to match the current device size.

Usage

1
plot_raster(filename, add = FALSE, ext = NULL, cols = NULL)

Arguments

filename

source

add

add to the plot

Details

The data is read in at the resolution required by the current device, assuming it's a single panel. TODO: read off the space to plot into from the device, and read only that window from the source at the right resolution.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## this file takes 5s to read in total from NetCDF, 24 seconds via GDAL
filename <- "/rdsi/PRIVATE/raad/data_local/www.bodc.ac.uk/gebco/GRIDONE_2D.nc"
#filename <- raadtools::topofile()
#filename <- "D:/data/topography/etopo2/subset.tif"
library(vapour)
## read in to match the device and it's quicker
plot_raster(filename)
#zoom(wrld_simpl, new = FALSE)
#plot_raster(filename, ext = spex::spex(), add = T, col = rainbow(100))
#maps::map(add = TRUE)
## library(sf); plot(st_transform(sst_c, 4326), add = T)
##for (i in sample(seq_len(nrow(wrld_simpl)))) {plot_raster(filename, ext = raster::extent(wrld_simpl[i, ])); plot(wrld_simpl[i, ], add = TRUE)}

r-gris/otg documentation built on May 26, 2019, 1:33 p.m.