[Gdal-dev] define block size for GTIFF

Frank Warmerdam fwarmerdam at gmail.com
Thu Feb 24 23:29:34 EST 2005


On Thu, 24 Feb 2005 22:08:09 -0600, Xiaodong Zhang <zhang at aero.und.edu> wrote:
> Hi,
> 
> We're using GDAL to read in a binary raw image (already in projected format)line
> by line and wrtie out as a GTIFF image after SetGeoTransform and SetProjectioin
> using:
> for (j=0,j<Yvalue;j++){
> fread(rowData,sizeof(float),Xvalue,inFile);
> poBand->RasterIO(GF_Write,0,j,Xvalue,1,rowData,Xvalue,1,GDT_Float32,0,0);}
> 
> I'm wondering how can I set a block size and how to use it. Will that be faster
> than what I'm doing now.

Xiaodong,

You can control the output blocking of GeoTIFF files with the
TILED=YES, and BLOCKXSIZE and BLOCKYSIZE creation 
options.  These are described in the GeoTIFF driver page at:

  http://www.gdal.org/frmt_gtiff.html

Generally speaking, to learn details of individual drivers find
their driver page off the Supported Formats page. 

As to whether this will result in improved performance for you, 
that will depend on a variety of factors.  Generally speaking if
you are reading and writing line by line then a line oriented
file will perform better than (or at least comparible to) a tiled
file.  Tiled files mostly benefit when you need to do 
subwindow access to a file. 

> Also I know GTIFF has an option of compressing image, does GDAL support that?

Yes, but there are issues with doing "random writes" to compressed
TIFF files with GDAL.  It works best with batch translations (ie
CreateCopy() or gdal_translate). 
 
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    | Geospatial Programmer for Rent



More information about the Gdal-dev mailing list