Even, Thanks for the fix.
I use bStrict = 1 when calling CreateCopy(). This could be why I see the error. I think gdal_translate uses bStrict = FALSE by default. if( !bStrict ) { CPLPopErrorHandler(); CPLErrorReset(); } else eErr = CPLGetLastErrorType(); <---------- eErr get CE_Warning here. } > -----Original Message----- > From: Even Rouault [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2008 1:17 PM > To: Peng Gao > Cc: gdal-dev@lists.osgeo.org > Subject: Re: [gdal-dev] GDAL 1.6.0 GDALValidateCreationOptions > > Gao, > > I've tried gdal_translate on a 3 band TIFF to a BMP image and > it works. Well, I get the warning twice because the BMP > driver doesn't implement the > CreateCopy() method, but apart the warning, the resulting > image is correct. > I'd be interested if you could find some code snippet that > reproduces the problem. > > Anyway, I've added as you suggested a configuration option to > skip the call to GDALValidateCreationOptions(). Just define > GDAL_VALIDATE_CREATION_OPTIONS=NO. > The default is YES, which I believe is the most sensible > value for most usages. I personnaly find it usefull to be > reminded that I pass wrong options due to typo, etc.. > > See http://trac.osgeo.org/gdal/changeset/15685 > > Regards, > Even > > Le Tuesday 04 November 2008 01:53:32 Peng Gao, vous avez écrit : > > Hi Even, > > I got the failure when converting a 3 band img to a BMP > image. I think > > converting a tiff to BMP will reproduce as well. > > I was thinking to make validation optional at run time by > setting, e.g. > > config value. > > > > > > Thanks, > > Gao, Peng > > > > > -----Original Message----- > > > From: Even Rouault [mailto:[EMAIL PROTECTED] > > > Sent: Monday, November 03, 2008 2:43 PM > > > To: gdal-dev@lists.osgeo.org > > > Cc: Peng Gao > > > Subject: Re: [gdal-dev] GDAL 1.6.0 GDALValidateCreationOptions > > > > > > Hi, > > > > > > Create()/CreateCopy() shouldn't fail if there's a warning due to > > > GDALValidateCreationOptions(). At least, I don't > understand how this > > > can happen. Do you notice that behaviour with a specific > driver ? I > > > couldn't reproduce a failure. > > > > > > For example, something like: > > > gdal_translate foo.tif bar.tif -co BAD_OPTION=YES > > > > > > just emits "Warning 6: Driver GTiff does not support BAD_OPTION > > > creation option" but the translation is done correctly. > > > > > > As far as avoiding the warning itself, there's always the > > > possibility of querying the GDAL_DMD_CREATIONOPTIONLIST metadata > > > item on the driver and look for the "TFW" string in it to > see if the > > > option is supported or not. > > > > > > What would be your idea to make it optional ? At > compilation time ? > > > Run time ? > > > > > > Regards, > > > Even > > > > > > Le Monday 03 November 2008 23:11:45 Peng Gao, vous avez écrit : > > > > Hi All, > > > > > > > > Create()/CreateCopy() now validates the creation options using > > > > GDALValidateCreationOptions(). > > > > > > GDALValidateCreationOptions() generates > > > > > > > a warning if any of creation options is not supported > by the driver. > > > > Create()/CreateCopy() fails if there is a warning. > > > > > > > > This seems to be too harsh. My app breaks now since it > > > > > > always includes > > > > > > > a "TFW" creation option. > > > > > > > > Can the validation be optional? > > > > > > > > Regards, > > > > Gao, Peng > > > > _______________________________________________ > > > > gdal-dev mailing list > > > > gdal-dev@lists.osgeo.org > > > > http://lists.osgeo.org/mailman/listinfo/gdal-dev > > > > _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev