Description Usage Arguments Details Value Warning Examples
A lazyraster is a metadata-only shell around a raster file source. Only metadata is read and and used for extent and resolution logic. A lazyraster may be cropped lazily and if plotted or converted to in-memory raster only a reasonable level-of-detail is actually used.
1 | lazyraster(gdalsource, band = 1, sds = NULL, ...)
|
gdalsource |
a file name or other source string |
band |
which band to use, defaults to 1 |
sds |
which subdataset to use, set to 1 if in doubt (see |
... |
ignored for now |
See crop()
for cropping - it works the same but returns a lazyraster,
and as_raster()
for converting to an in-memory raster.
a lazyraster object, a simple shell around a GDAL raster source
If the inferred Y extents appear to be reversed (ymax > ymin) then they are reversed, with a warning. This occurs for any GDAL data source that does not have a geotransform and so is required for use with raster. This might not be the right interpretation, geotransforms are very general and it might mean the data is meant to be oriented that way. (I don't know why GDAL sets a positive Y pixel height as the default, it's a bit of a pain - should the data be flipped, or should Y be interpreted negative - no way to know!).
1 2 3 4 5 6 7 8 | sstfile <- system.file("extdata/sst.tif", package = "vapour")
lazyraster(sstfile)
## convert to raster (in memory, but not all of the source)
as_raster(lazyraster(sstfile))
## crop and stay as lazyraster
crop(lazyraster(sstfile), raster::extent(142, 143, -50, -45))
## crop and convert to raster
as_raster(crop(lazyraster(sstfile), raster::extent(142, 143, -50, -45)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.