[Gdal-dev] GdalCreate

MIKAH JAMES TRENT mjtrent at wisc.edu
Thu Apr 26 16:13:05 EDT 2007


Hi,
I am using the 'swigged' version of Gdal in C-Sharp.  I am struggling with the GdalCreate command.

Here is a summary of my code:

           Driver dv;
           Dataset ds;
//this command gets the driver
            dv = gdal.GetDriverByName(format_dictionary[ext]);
//this command does what????
            ds = dv.Create(path, x_size, y_size, 1, 1, null);


My 'format_dictionary[ext]' in this case returns 'HFA' which is the format for .img files.  However, when I call dv.Create, it immediately creates a file with the correct EHFA_HEADER_TAG header followed by a few null characters, and then there's a bunch of junk data following it, like:

HeaderLength,1:LdictionaryPtr,}Ehfa_File,{1:Lnext,1:Lprev,1:Lparent,1:Lchild,1:Ldata,1:ldataSize,64:cname,32:ctype,1:tmodTime,}Ehfa_Entry,{16:clabel,1:LheaderPtr,}Ehfa_HeaderTag,{1:LfreeList,1:lfreeSize,}Ehfa_FreeListNode,{1:lsize,1:Lptr,}Ehfa_Data,{1:lwidth,1:lheight,1:e3:thematic,athematic,fft of real-valued...

which makes it an invalid file.  Where does this data come from, and how do I get just a normal valid file of type img??

Thank you for any help!!
-Mikah



Mikah J. Trent
(414) 238 3573
mjtrent at wisc.edu



More information about the Gdal-dev mailing list