[Gdal-dev] LAYER_TYPE=thematic
Frank Warmerdam
fwarmerdam at gmail.com
Thu May 19 15:08:23 EDT 2005
On 5/13/05, Schumann, Eike, VF-DE <eike.schumann at vodafone.com> wrote:
> //***************** Interesting part begin
> ******************************************
> //**********************************************************************
> *************
>
> GDALRasterBand* poBand = poDst->GetRasterBand(1);
>
> pMetaData = poBand->GetMetadata();
> CSLSetNameValue( pMetaData, "LAYER_TYPE", "thematic");
>
> poBand->RasterIO( GF_Write, 0, 0, image.metaData.cols,
> image.metaData.rows, pixels, image.metaData.cols, image.metaData.rows,
> GDT_UInt16,0,0);
Eike,
I applogise for the very late response. First, you are not quite using
the poorly documented (or undocumented?) CSLSetNameValue() function
properly. A more "proper" implementation might look like:
char **pMetadata;
pMetadata = CSLDuplicate(poBand->GetMetadata());
pMetadata = CSLSetNameValue( pMetadata, "LAYER_TYPE", "thematic");
poBand->SetMetadata( pMetadata );
CSLDestroy( pMetadata );
However, the simpler form would be:
poBand->SetMetadataItem( "LAYER_TYPE", "thematic" );
Then, in theory, when the dataset is closed, the layer type would
be reset to thematic. However, I did not test that just now, so you
still might have problems.
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