[gdal-dev] using GDALCreateCopy and changing only the datatype

Yann Chemin yann.chemin at gmail.com
Mon Nov 24 08:57:33 EST 2008


Hi Sjur,

I found out that in:
hDatasetOut0 = GDALCreateCopy( hDriver1, ndviF, hDataset1,FALSE,NULL,NULL,NULL);

the FALSE argument was there to inhibit strict identity to the parent
dataset it copies. However, when trying to induce it to write in
GDT_Float64 instead of int32, it brings out the file as int32....

so far for allowing change...
Yann

2008/11/24 Kolberg Sjur A <Sjur.A.Kolberg at sintef.no>:
>
> Hi Yann,
>
> I had this same problem and found no other solution than to switch from CreateCopy() to Create().
>
> Good luck,
>
> Sjur K :-)
>
>
> Sjur Kolberg
> SINTEF Energiforskning A/S
> Sem Sælands vei 11
> 7465 Trondheim
> tlf. 73 59 72 78
> fax  73 59 72 50
>
>
>> -----Original Message-----
>> From: gdal-dev-bounces at lists.osgeo.org
>> [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Yann Chemin
>> Sent: 24 november 2008 14:10
>> To: gdal-dev at lists.osgeo.org
>> Subject: [gdal-dev] using GDALCreateCopy and changing only
>> the datatype
>>
>> 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);
>>
>> thanks,
>> Yann
>>
>> --
>> Yann Chemin
>> International Rice Research Institute
>> Office: http://www.irri.org/gis
>> Perso: http://www.freewebs.com/ychemin
>> YiKingDo: http://yikingdo.unblog.fr/
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>



-- 
Yann Chemin
International Rice Research Institute
Office: http://www.irri.org/gis
Perso: http://www.freewebs.com/ychemin
YiKingDo: http://yikingdo.unblog.fr/


More information about the gdal-dev mailing list