[R-sig-Geo] Performance of raster package

Robert Hijmans r.hijmans at gmail.com
Tue May 24 20:00:09 CEST 2011


Thanks for pointing this out. Some functions in 'raster' are indeed
slower/faster than others. Some seem to be reasonably quick. The focal*
functions are slow, and indeed, as Rainer alludes to, good candidates for a
C-implementation of at least the basic cases (e.g. fun=mean). Although I
recently made them a bit more efficient, so it would be good to know which
version of raster you are using. When reporting speed problems, please also
report the number of rows/columns of the object and the exact function
(focal, focalFilter, focalNA?) used. In the case of the focal functions it
could matter a lot which "fun" you used to compute the focal values; as that
might be what further slows things down. rasterToPolygons is also slow; in
part because I did not pay much attention to it. I just made it a bit
quicker (almost twice as fast), but much more could probably be done. That
is, speed is not only a function of R vs. C code, but also of the quality of
the algorithm used. The value of the 'raster' package over "GIS" software is
obviously not speed of execution, but the ease (speed) of use and the
benefit of the integration with everything else in R. 

Robert


>  Am 24.05.2011 10:17, schrieb Luca Morandini: 
> 
>  Folks, 
>> 
>> I have played a bit with the R "raster" package, and found it has an 
>> impressive list of features; however, its performance seems to be less
>> than 
>> optimal when confronted with sizeable rasters (say, a 250MB GeoTIFF): a 
>> focal statistics that took less than a minute in GRASS, took 7 hours or
>> so 
>> in R. 
>> 
>> Is there anything I could do to speed it up (I already tried readAll 
>> before invoking the focal statistic function) ? 
>> 
>> Regards, 
>> 
>> Luca Morandini 
>> http://www.lucamorandini.it
>> 
>> _______________________________________________ 
>> R-sig-Geo mailing list 
>> [hidden email] 
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> 
> Dear all, 
> 
> I discovered such performance problems concerning computation time, too. 
> Using the function rasterToPolygons() for a 30Mb, 1Byte integer GeoTiff
> took 
> 10 times longer than using a common GIS software. Why is that the case? I 
> had to change to other R implementet GIS functionallity like in the
> package 
> RSAGA. When posible reading data into memory will also accelerate
> processing 
> time. 
>

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Performance-of-raster-package-tp6397653p6399759.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list