[R-sig-Geo] stack many files without loading into memory

Dominik Schneider Dominik.Schneider at colorado.edu
Wed Feb 4 20:51:33 CET 2015


Wouldn't that keep the link to the server on which they are stored now?

Dominik Schneider
o 303.735.6296 | c 518.956.3978


On Wed, Feb 4, 2015 at 12:50 PM, Michael Sumner <mdsumner at gmail.com> wrote:

> Why not stack(fn)
>
> ?
>
> On Thu, 5 Feb 2015 06:41 Dominik Schneider <Dominik.Schneider at colorado.edu>
> wrote:
>
>> Hi -
>> I have some data on a server but would like to bring them local in a
>> somewhat compressed format that is still easy to access.
>>
>> /Volumes/hD/2012 -> 100 geotiffs
>> ~/project/data/ -> store those geotiffs here without needing server
>> access.
>>
>> untested, I think I could do something like:
>> s=stack()
>> writeRaster(s,'2012stack')
>> fn=list.files('/Volumes/hD/2012',pattern='*.tif',full.names=T)
>> lapply(fn,function(f){
>> s=stack('2012stack')
>> r=raster(f)
>> names(r)=gsub(pattern='.tif',replacement='',basename(f))
>> s=addLayer(s,r)
>> writeRaster(s,'2012stack')
>> })
>> Or is it better to save to a .RData?
>> Is there a better way that doesn't require me to loop through each geotiff
>> since I can't load it all into memory.
>> Thanks
>> Dominik
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list