On Tue, 5 Aug 2008, Agustin Lobo wrote:
Hi!
is it possible to read a tiff file with readGDAL but just keeping
one pixel every p columns and q lines? That is,
a systematic sampling at reading. This is good to save memory
and still be able of displaying and performing
statistics. As images are large,
reading in the entire image and then sampling is not
an alternative.
If this is not contemplated in the readGDAL function,
is there any way to just read in one line, perform
the sampling and then go on with the next line?
I think I did this with binary images few years
ago, but using tiff would be much better for
practical reasons.
Look at the offset=, band= and region.dim= arguments to readGDAL() - you
could capture the GDALinfo() output to set the frame if need be. It may be
more efficient to use GDAL.open()/GDAL.close() and getRasterData() at a
lower level if you are taking many samples - loop over different values of
offset= with region.dim=c(1,1). Note that offset= may be from the NW
corner, not the SW corner, and that the arguments are (often) ordered
(y, x).
Roger
Thanks
Agus
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo