[gdal-dev] using GDALCreateCopy and changing only the datatype
Frank Warmerdam
warmerdam at pobox.com
Mon Nov 24 11:55:47 EST 2008
Yann Chemin wrote:
> Hello,
>
> I would like to use GDALCreateCopy and change the datatype from int32
> to float32.
>
> GDALDatasetH hDatasetOut0;
> hDatasetOut0 = GDALCreateCopy( hDriver1, ndviF,
> hDataset1,FALSE,NULL,NULL,NULL);
> GDALRasterBandH hBandOut0;
> hBandOut0 = GDALGetRasterBand(hDatasetOut0,1);
Yann,
Generally speaking to do this with CreateCopy() you would need to create
an intermediate virtual dataset with the altered pixel data type. This is
how the -ot flag of gdal_translate works. You can review the
gdal_translate.cpp code as an example, though it is somewhat involved.
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