[GRASS-user] rgrass7: writeRAST fails with large rasters

,

I have a large raster (~2 GB) that I’m trying to export to grass from R (3.4.1) using the rgrass7 (0.1-9) library:

writeRAST(
as(raster(“dinf_slope.tif”),“SpatialGridDataFrame”),
“slope.r”,
flags=c(“overwrite”)
)

The operation fails and throws the following error:

Error in writeBin(z, con = f, size = sz) :

only 2^31-1 bytes can be written in a single writeBin() call

I get the same error if I attempt to export a SpatialGridDatatFrame object directly, so I don’t believe the problem is with the raster library.

I receive the same error in Ubuntu and Windows 10.

How can I use writeRAST to export large rasters to grass?

Cross posted to stack exchange (https://goo.gl/5bBmV3)

On Sat, Jul 29, 2017 at 4:34 PM, Scott Morford <smorford@gmail.com> wrote:

I have a large raster (~2 GB) that I’m trying to export to grass from R (3.4.1) using the rgrass7 (0.1-9) library:

writeRAST(
as(raster(“dinf_slope.tif”),“SpatialGridDataFrame”),
“slope.r”,
flags=c(“overwrite”)
)

The operation fails and throws the following error:

Error in writeBin(z, con = f, size = sz) :

only 2^31-1 bytes can be written in a single writeBin() call

this error comes from the R function writeBin. Maybe it would be safer to use writeGDAL within writeRAST.

I get the same error if I attempt to export a SpatialGridDatatFrame object directly, so I don’t believe the problem is with the raster library.

I receive the same error in Ubuntu and Windows 10.

How can I use writeRAST to export large rasters to grass?

Don’t use writeRAST, use writeGDAL instead and then import the output of writeGDAL into GRASS.

Markus M