Skip to content

rgdal::writeGDAL temporary files

2 messages · Oliver Soong, Roger Bivand

#
I'm processing and outputting a large number of large GeoTIFFs.  Every
time I write one, I get a new intermediate file in tempdir().  I do
not have enough space in my temporary folder to store all of these
intermediates.  I believe these intermediate files back the
GDALTransientDataset objects created by create2GDAL called from
writeGDAL (I think), which are then copied to a data drive by
saveDataset.  After saveDataset, though, the transient object is
orphaned.

Is it possible to tell rgdal to remove these transients after
writing/saveDataset?  Alternatively, is it possible to tell rgdal to
write these intermediates to a particular location?

I can think of two workarounds, but I'd love to hear better ideas.  I
could redirect R's tempdir, although this is rather inconvenient.  I
can also try to detect the temporary files and delete them manually,
although this is probably driver- and version-specific and so less
robust than I would prefer.

Cheers,
Oliver
1 day later
#
On Wed, 19 Sep 2012, Oliver Soong wrote:

            
Thanks for the report. A long time ago, there must have been an issue 
here, because a GDAL.close() - on the wrong object - was commented out. 
After checking, I've committed a fix to the rgdal R-forge project. If you 
can install rgdal from source, I'd be grateful for feedback on that; if 
you need a Windows binary, please let me know, and I'll submit the source 
package to win-builder to create one.

Roger