[Gdal-dev] GdalCreate
Frank Warmerdam
warmerdam at pobox.com
Fri Apr 27 15:59:42 EDT 2007
MIKAH JAMES TRENT wrote:
> 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,
Erdas Imagine files include an internal dictionary defining all the objects
in the file. That's what all the "Ehfa_File..." stuff is about. Why do you
think this is an invalid file?
Note that the file will likely not be flushed out and completely valid till
after you close the dataset handle you get back from Create().
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 OSGeo, http://osgeo.org
More information about the Gdal-dev
mailing list