[Gdal-dev] Using CreateCopy() with ENVI data

Frank Warmerdam fwarmerdam at gmail.com
Mon Mar 14 13:18:50 EST 2005

On Mon, 14 Mar 2005 18:13:22 +0100, Wim Koolhoven <koolhoven at itc.nl> wrote:
> Frank,
> Most users want same input format as output.
> A function ENVIDataset::Create() is defined, but
> ENVIDataset::CreateCopy() seems not to be present. Is this a virtual
> function which can just be created?
> Can I implement the function that I only implement it for when the input
> dataset is also ENVI and in all other cases call the default
> implementation? I only have seen complete implementations.


If CreateCopy() is not defined there is a default internal implementation
which uses Create(), and then copies over the various kinds of data
items defined.  In cases where it is possible to implement Create() fully,
it is normally not expected to implement CreateCopy() though it is
possible to implement both.

I have not yet implemented a CreateCopy() that actually went "into" 
the source datasource to determine it's format to allow special operation.
I would like to discourage this approach.  But if you do want a CreateCopy
to work very smoothly for ENVI data you could have the read driver
return the whole ENVI header as a special metadata domain value. 
Then a CreateCopy() could actually query the source dataset for this
specific metadata item in a special domain to use as a template header.

But I think it would be better to just add conventional support in the
ENVI driver for as many items as possible (category names, etc) using
the normal GDAL data model. 

It really depends on your needs, and time available for implementation.

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