[Gdal-dev] mean value of rasters
Ari Jolma
ari.jolma at tkk.fi
Fri May 5 01:28:46 EDT 2006
Maciek Sieczka kirjoitti:
> On Thu, 04 May 2006 15:59:53 -0400
> Frank Warmerdam <warmerdam at pobox.com> wrote:
>
>
>> Christopher Condit wrote:
>>
>>> I've got N raster files (GeoTiffs) of equal size and dimensions.
>>> I'd like to create a single raster with the mean value of these N
>>> rasters (cell by cell). Is there a good way to do this with GDAL,
>>> or with another tool?
>>>
>> Chris,
>>
>> There is not direct way of doing this with the commandline utilities.
>> It would be relatively easy to implement using Python bindings for
>> GDAL and Numerical Python. I imagine this could also be done in
>> something like R or GRASS relatively directly.
>>
>
> Yes, straightforward in Grass:
>
> r.in.gdal to import geotiff rasters
>
May take a loooong time depending on the size of the raster.
> g.region rast=1st_raster
>
> r.mapcalc 'mean_raster=(1st_raster+2nd_raster+3rd_raster)/3'
>
The requirement was for N rasters and not 3.
I'd suggest using GDAL scripting. My (evolving set of simple) examples
of simple tasks are here:
http://map.hut.fi/PerlForGeoinformatics/examples.html
Regards,
Ari
> r.out.gdal to export mean_raster back to geotiff
>
> Maciek
>
> --------------------
> W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze z nich!
> http://katalog.panoramainternetu.pl/
>
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev
>
--
Prof. Ari Jolma
Kartografia ja Geoinformatiikka / Cartography and Geoinformatics
Teknillinen Korkeakoulu / Helsinki University of Technology
POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma
More information about the Gdal-dev
mailing list