Marco,<br><br>1. You misspelled the option for world file creation as 'TWF' which should actually be 'TFW'.<br>2. The driver did report the error message correctly after processing the creation options. There may be a bug with the debugger.<br>
<br><br><div class="gmail_quote">On Tue, Jul 6, 2010 at 6:26 AM, Marco Zuliani <span dir="ltr"><<a href="mailto:zuliani@mayachitra.com">zuliani@mayachitra.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>Dear all,</div><div><br></div><div> I am trying to utilize GDAL to generate a geo-tiff image from scratch. I have been following the tutorial presented at <a href="http://www.gdal.org/gdal_tutorial.html" target="_blank">http://www.gdal.org/gdal_tutorial.html</a> and I have been reading the documentation of the functions involved in the process, but so far I have not beed successfull in accomplishing my goal.</div>
<div> </div><div> In the following I will first paste (partially) my routine in the fervent hope that somebidy can spot my error and help me out. I will denote with [...] portions of the code that have been omitted because I believe they are not relevant to my question. After the listing I will present my questions.</div>
<div> </div><div> --- CODE BEGINS ---</div><div> </div><div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">[...]</font></div>
<div><font face="'courier new', monospace"> </font></div><div><font face="'courier new', monospace"> // There is a driver for each supported format. Attempt to register all known drivers</font></div>
<div><font face="'courier new', monospace"> // Ensure that GDALAllRegister() has been called before calling GetDriverByName().</font></div><div><font face="'courier new', monospace"> GDALAllRegister();</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> // select the geotiff format for GDAL</font></div>
<div><font face="'courier new', monospace"> const char *pszFormat = "GTiff";</font></div><div><font face="'courier new', monospace"> GDALDriver *poDriver = GetGDALDriverManager()->GetDriverByName( pszFormat );</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> // make some checks to avoid headaches in the future</font></div>
<div><font face="'courier new', monospace"> if ( poDriver == NULL )</font></div><div><font face="'courier new', monospace"> {</font></div><div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">// take care of the error condition</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">[...]</font></div>
<div><font face="'courier new', monospace"> }</font></div><div><font face="'courier new', monospace"> </font></div><div><font face="'courier new', monospace"> // get some info regarding the GDAL driver</font></div>
<div><font face="'courier new', monospace"> char **papszMetadata = poDriver->GetMetadata();</font></div><div><font face="'courier new', monospace"><br>
</font></div><div><font face="'courier new', monospace"> if ( !CSLFetchBoolean( papszMetadata, GDAL_DCAP_CREATE, FALSE ) )</font></div><div><font face="'courier new', monospace"> {</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">// take care of the error condition in case creation is not possible</font></div>
<div><font face="'courier new', monospace"> }</font></div><div><font face="'courier new', monospace"><br></font></div><div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">[...]</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">// at this point the some variables used in a while have the following values</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">// width = 251</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">// height = 234</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">// bands = 4</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span></div><div><font face="'courier new', monospace"> // this hosts the list of driver specific control parameters.</font></div>
<div><font face="'courier new', monospace"> // See <a href="http://www.gdal.org/frmt_gtiff.html" target="_blank">http://www.gdal.org/frmt_gtiff.html</a></font></div><div><font face="'courier new', monospace"> char **papszOptions = NULL;</font></div>
<div><font face="'courier new', monospace"> papszOptions = CSLSetNameValue( papszOptions, "TWF", "NO" );</font></div><div><font face="'courier new', monospace"> papszOptions = CSLSetNameValue( papszOptions, "TILED", "NO" );</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> int height = FreeImage_GetHeight( I );</font></div>
<div><font face="'courier new', monospace"> int width = FreeImage_GetWidth( I );</font></div><div><font face="'courier new', monospace"> // this is the georeferenced image</font></div>
<div><font face="'courier new', monospace"> const char *options = GDALGetDriverCreationOptionList(poDriver); </font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span></div>
<div><font face="'courier new', monospace"> GDALDataset *Ig = poDriver->Create( "test.tif", width, height, bands, GDT_Byte, papszOptions );</font></div><div><span style="white-space: pre-wrap;">        </span></div>
<div>--- CODE ENDS ---</div><div><br></div><div>Questions:</div><div><br></div><div>1] The program outputs to the console the following message: "Warning 6: Driver GTiff does not support TWF creation option". Why? From the documentation at <a href="http://www.gdal.org/frmt_gtiff.html" target="_blank">http://www.gdal.org/frmt_gtiff.html</a> it seems that such option is supported...</div>
<div><br></div><div>2] From Visual Studio debugger I can see that the values of poDriver are messed up and also the values of eAccess, nRasterXSize, nRasterYSize, nBands seem to be scrabled (I would expect nBands = 4, nRasterXsize = 251, etc.). Does anybody have an idea of what's going on? (Please find below the output of the debugger Name/Value/Type)</div>
<div><br></div><div><font face="'courier new', monospace">-</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">Ig</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">0x00000000039fa450 {hTIFF=0x00000000039fa000 ppoActiveDSRef=0x00000000039fa560 poActiveDS=0x00000000039fa450 ...}</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">GDALDataset *</font></div>
<div><font face="'courier new', monospace">+</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">[GTiffDataset]</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">{hTIFF=0x00000000039fa000 ppoActiveDSRef=0x00000000039fa560 poActiveDS=0x00000000039fa450 ...}</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">GTiffDataset</font></div>
<div><font face="'courier new', monospace">+</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">GDALMajorObject</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">{nFlags=33 sDescription={...} oMDMD={...} }</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">GDALMajorObject</font></div>
<div><font face="'courier new', monospace">-</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">poDriver</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">0x000000fb00000001 {pfnOpen=??? pfnCreate=??? pfnDelete=??? ...}</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">GDALDriver *</font></div>
<div><font face="'courier new', monospace">+</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">GDALMajorObject</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">{nFlags=??? sDescription={...} oMDMD={...} }</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">GDALMajorObject</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">pfnOpen</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">CXX0030: Error: expression cannot be evaluated</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">pfnCreate</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">CXX0030: Error: expression cannot be evaluated</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">pfnDelete</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">CXX0030: Error: expression cannot be evaluated</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">pfnCreateCopy</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">CXX0030: Error: expression cannot be evaluated</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">pDriverData</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">CXX0030: Error: expression cannot be evaluated</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">pfnUnloadDriver</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">CXX0030: Error: expression cannot be evaluated</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">pfnIdentify</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">CXX0030: Error: expression cannot be evaluated</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">pfnRename</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">CXX0030: Error: expression cannot be evaluated</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">pfnCopyFiles</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">CXX0030: Error: expression cannot be evaluated</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">eAccess</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">234</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">GDALAccess</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">nRasterXSize</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">4</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">int</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">nRasterYSize</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">60761968</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">int</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">nBands</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">0</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">int</font></div>
<div><font face="'courier new', monospace">+</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">papoBands</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">0x0000000100000000</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">GDALRasterBand * *</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">bForceCachedIO</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">0</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">int</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">nRefCount</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">-1163005939</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">int</font></div>
<div><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">bShared</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">0</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">int</font></div>
<div><font face="'courier new', monospace">+</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">                </font></span><font face="'courier new', monospace">oOvManager</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">{poDS=0x0000000000000000 poODS=0xbaadf00dbaadf00d osOvrFilename={...} ...}</font><span style="white-space: pre-wrap;"><font face="'courier new', monospace">        </font></span><font face="'courier new', monospace">GDALDefaultOverviews</font></div>
<div><br></div><div>Thanks in advance for your help,</div><div>Marco</div><div><br></div>Marco Zuliani, Phd<br><br>phone: +1 805 967 9828<br>web: <a href="http://www.mayachitra.com" target="_blank">www.mayachitra.com</a><br>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>
/tʃaɪθənjə/ /kʊmɑr/ <br>+91-9494447584<br>17.2416N 80.1426E<br>