An array in memory can be referenced by a GDAL data source.
mem(
x,
extent = NULL,
projection = "",
PIXELOFFSET = 0L,
LINEOFFSET = 0L,
BANDOFFSET = 1L
)
an R array, must be of numeric type (integer is converted to double)
optional extent of the data in x,y c(xmin, xmax, ymin, ymax)
projection string (optional, sets the SPATIALREFERENCE of the MEM driver since GDAL 3.7)
character string, a DSN for use by GDAL
This DSN will only work in R, and is only for use with GDAL read and query tools (so terra, sf, gdalcubes, vapour, etc.).
m <- matrix(as.integer(c(0L, 0, 0, 1)), 5L, 4L)
mem(m)
#> [1] "MEM:::DATAPOINTER=\"94183418072768\",PIXELS=5,LINES=4,BANDS=1,DATATYPE=Float64,GEOTRANSFORM=0/1/0/4/0/-1,PIXELOFFSET=0,LINEOFFSET=0,BANDOFFSET=160"
mem(volcano)
#> [1] "MEM:::DATAPOINTER=\"94183506760832\",PIXELS=87,LINES=61,BANDS=1,DATATYPE=Float64,GEOTRANSFORM=0/1/0/61/0/-1,PIXELOFFSET=0,LINEOFFSET=0,BANDOFFSET=42456"