[Gdal-dev] mean value of rasters
Christopher Condit
condit at sdsc.edu
Fri May 5 18:19:59 EDT 2006
I tried in R and came very close. My script looked something like this
(just to make sure things were working):
library(rgdal)
ds <- GDAL.open("C:/path/test.tif")
vals <- getRasterData(ds)
GDAL.close(ds)
write.table(vals, "C:/path/out.txt")
But when I look at that file as an ASCII grid (which makes sense to do,
right?) my original image is rotated 90 degrees and doubled.
Am I missing something about the rgdal component? Seems that it should
have worked...
Thanks,
Chris
-----Original Message-----
From: Frank Warmerdam [mailto:fwarmerdam at gmail.com] On Behalf Of Frank
Warmerdam
Sent: Thursday, May 04, 2006 1:00 PM
To: Christopher Condit
Cc: Gdal-dev at lists.maptools.org
Subject: Re: [Gdal-dev] mean value of rasters
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.
Best regards,
--
---------------------------------------+--------------------------------
------
I set the clouds in motion - turn up | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGF,
http://osgeo.org
More information about the Gdal-dev
mailing list