[Gdal-dev] Re: RasterIO: replicating a value

Frank Warmerdam fwarmerdam at gmail.com
Wed Feb 16 20:30:56 EST 2005


On Wed, 16 Feb 2005 15:35:34 -0800, Carlos A. Rueda <carueda at ucdavis.edu> wrote:
> Hi Frank,
> 
> Attached is a small test program that recreates (at least for me)
> the problem:
> 
> $ g++ rasteriotest.cc -lgdal
> $ ./a.out
> result = 0
> $ ls -l
> -rwxr-xr-x    1 carueda  carueda     36774 Feb 16 15:03 a.out
> -rw-r--r--    1 carueda  carueda    604000 Feb 16 15:12 rasterfilename
> -rw-r--r--    1 carueda  carueda       339 Feb 16 15:12 rasterfilename.hdr
> -rw-r--r--    1 carueda  carueda      1185 Feb 16 15:09 rasteriotest.cc
> 
> but rasterfilename should be 1000x1000x1x4 = 4000000 bytes long.
> Well, I'm assuming that just creating/deleting the dataset object would
> set the whole size of the file (with whatever default band values)
> regardless of what data are explicitily written. If this is not the
> case, how can I guarantee the desired size without having to write
> the whole dataset (my application is certainly filling some regions
> but not the whole thing necessarily).

Carlos, 

There is no guarantee that all the space required for a file will be
allocated at the Create() call or even when a newly created files is
closed.  If you want to be certain that the file is fully written out you
will need to call Fill() on it, or in some other fashion write the whole
thing. 

Sorry ... I realize that isn't the answer you were hoping for. 

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