<div dir="ltr"><div><p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">Hi,</font></span></p><font color="#000000" face="Times New Roman" size="3"></font><p class="MsoNormal" style="margin:0cm 0cm 0pt">
<span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000"> </font></span></p><font color="#000000" face="Times New Roman" size="3"></font><p class="MsoNormal" style="margin:0cm 0cm 0pt">
<span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">I’ve encountered some problems with the PCIDSK raster driver. </font></span></p><font color="#000000" face="Times New Roman" size="3"></font><p class="MsoNormal" style="margin:0cm 0cm 0pt">
<span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000"> </font></span></p><font color="#000000" face="Times New Roman" size="3"></font><p class="MsoNormal" style="margin:0cm 0cm 0pt">
<span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">Even if the raster is opened with update=0 the driver wants to write statistics and overviews to the pix file, which produces an error “File not open for update in WriteToFile”.</font></span></p>
<font color="#000000" face="Times New Roman" size="3"></font><p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">You can reproduce this with the files from</font></span></p>
<span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000"><div>pix_test.zip - <a href="https://drive.google.com/file/d/0B_pKTK9WcAW4bEM3dG5BazlGbjA/edit?usp=sharing">https://drive.google.com/file/d/0B_pKTK9WcAW4bEM3dG5BazlGbjA/edit?usp=sharing</a></div>
</font></span><p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">Open it with update=0, calculate statistics and close it. The error is produced when closing the dataset.</font></span></p>
<font color="#000000" face="Times New Roman" size="3"></font><div class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">In the driver description it says “Internal overview (pyramid) images will also be correctly read though newly requested overviews will be built externally as an .ovr file.”. This seems not to be the case, overviews are always written to the pix file. Wouldn't it be better if the statistics and overviews were stored in separate files when the file was opened with update=0?</font></span></div>
<div class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000"> </font></span></div><font color="#000000" face="Times New Roman" size="3"></font><p class="MsoNormal" style="margin:0cm 0cm 0pt">
<span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">Also it seems like the driver can’t read the statistics when they are created with PCI, see attached file test_with_stats.pix. If you request the stats they are recalculated and rewritten to file. If not opened with update=1 see problem above.</font></span></p>
<font color="#000000" face="Times New Roman" size="3"></font><div class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000"> </font></span></div>
<div class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">Quick side note:</font></span></div><div class="MsoNormal" style="margin:0cm 0cm 0pt">
<span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">When using the C# wrapper (pseudo code):</font></span></div><div class="MsoNormal" style="margin:0cm 0cm 0pt">
<span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">Gdal.Open(pixFile, update=0)</font></span></div><div class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">band.GetStatistics()</font></span></div>
<div class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">dataset.Dispose() -> although here the problem with “File not open for update in WriteToFile” happens</font></span></div>
<div class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">anyOtherGDALCall() -> the Exception is thrown here</font></span></div>
<div class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000"></font></span> </div><div class="MsoNormal" style="margin:0cm 0cm 0pt">
<span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">This had me confused at first. Perhaps it would be good to add a "GdalPINVOKE.SWIGPendingException.Retrieve();" to the Dataset.Dispose() method, although it probably isn't nice design to throw an exception in the Dispose() method.</font></span></div>
<div class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000"></font></span> </div><div class="MsoNormal" style="margin:0cm 0cm 0pt">
This was tested with the current development version and the 1.10.0 final Version.</div><div class="MsoNormal" style="margin:0cm 0cm 0pt"> </div><div class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">Kind regards,</font></span></div>
<div class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt"><font color="#000000">Dennis</font></span></div></div></div>