[R-sig-Geo] Creating big raster from small tiles

steven mosher moshersteven at gmail.com
Mon Oct 17 08:25:01 CEST 2011


 Thanks,

    I basically have to reclass()  all 72 tiles, then aggregate() them
from 30 arc seconds to 5 minutes  and eventually put them in a brick
with other rasters
so I can average across the layers.

I thought unionExtent() was going to be the ticket, but that just
effects the extent.
unionRaster() is really what would be cool for working with tiles.
I'll take a look
at the gdal stuff

Steve



On Sun, Oct 16, 2011 at 10:01 PM, Robert J. Hijmans <r.hijmans at gmail.com> wrote:
> Steven,
> In principle you could give merge all tiles (e.g. make a list of RasterLayer
> objects and use do.call ) but merge is quite slow (something that can easily
> be be improved; and I expect it will be over the coming months).
> What I would do is use run gdalbuildvrt (that comes with the FWtools). This
> creates a single header file that lets you access all the tiles as a single
> virtual file. If you want a single file for better performance, you can use
> writeRaster to save it to e.g. a single geotiff file.
>
> Robert
>
> On Sun, Oct 16, 2011 at 8:54 PM, steven mosher <moshersteven at gmail.com>
> wrote:
>>
>>  I have 72 "tiles" in a tif format and each tile is   30X30
>>
>> >tile
>> class       : RasterLayer
>> dimensions  : 3600, 3600, 12960000  (nrow, ncol, ncell)
>> resolution  : 0.008333333, 0.008333333  (x, y)
>> extent      : 60, 90, 60, 90  (xmin, xmax, ymin, ymax)
>> coord. ref. : NA
>> values      : C:/Users/steve/....
>> min value   : 0
>> max value   : 255
>>
>> What I'd like to do is find  the fastest way to bring all 72 tiles
>> into one big raster.
>>
>> merge() seems like one good choice, where I would   merge each tile
>> with a blank raster that would get
>> filled in incrementally by each tile
>>
>> > world
>> class       : RasterLayer
>> dimensions  : 21600, 43200, 933120000  (nrow, ncol, ncell)
>> resolution  : 0.008333333, 0.008333333  (x, y)
>> extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
>> coord. ref. : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
>> +towgs84=0,0,0
>> values      : none
>>
>> world <- merge(tile, world)
>>
>> and the  repeat that for the remaining 71 tiles.  I'm also think that
>> one could extract the values from the tile
>> and use setValues  but  that appears to hit the memory wall in
>> Windows.  The other option
>> I suppose is to use writeValues()  and create  a big file from the tiles.
>>
>> Am I missing any obvious options?
>>
>> Steve
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>



More information about the R-sig-Geo mailing list