[Gdal-dev] Help changing raster data type

Andrew Finley afinley at gis.umn.edu
Mon Nov 3 18:15:46 EST 2003


Hello,
I am very new to programing and to the gdal lib. I am just manipulating
the values in a copy of an erdas image, and want this copied image to
have a different data type (IEEE 32bit float or the gdal equivalent). I
think I need to change one of the optional values in the createcopy()
but not sure which one, or if this is even the right track. Please see a
piece of my code below:


//get the driver
GDALDriver *poDriver;
poDriver = poDataset->GetDriver();

//name the output
GDALDataset *poDstDS;
const char **papszOptions = NULL;

//I know this is not right
papszOptions = CSLSetNameValue( papszOptions, "GDALDataType",
"GDT_Float32" );

//make output image
poDstDS = poDriver->CreateCopy( "p27_test_1band_signed16bit_out.img",
poDataset, FALSE, papzOptions, NULL, NULL);

if( poDstDS == NULL )
delete poDstDS;
...



I will appreciate any suggestion.
Regards-
andy 

-- 
Andrew Finley, Research Fellow
Department of Forest Resources
College of Natural Resources           
University of Minnesota
305 Green Hall
1530 Cleveland Avenue N.
St. Paul, MN 55108

Ph 612-624-1714 office
www.cnr.umn.edu/FR/people/facstaff/finley/index.html



More information about the Gdal-dev mailing list