<div dir="ltr"><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 found a problem with the shape file driver that occurs when reading features with a spatial filter from a large shapefile that has a spatial index (sbn).</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">The problem can be reproduced with this shapefile </font><a href="http://geofuse.geoeye.com/static/shp/GE1_2012.zip" target="_blank"><font color="#0000ff">http://geofuse.geoeye.com/static/shp/GE1_2012.zip</font></a><font color="#000000"> but it’s not only this shapefile, I have others that show the problem, all of them are rather big. Recalculating the spatial index (with ArcGIS) doesn’t solve the problem, the files seem to be valid.</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">When calling CPLGetLastError..() after the first GetNextFeature() a failure is returned with the message “Invalid node descriptor size in .sbn : 503800”.</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">It seems one could just ignore the Failure and continue reading the features. Everything seems fine (although it probably did not use the spatial index for filtering). </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">Perhaps a Warning instead of a Failure would suffice.</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">The error is generated in sbnsearch.c because “nNodeDescCount> nMaxNodes”. It seems the maximum tree depth of 15 is not enough.</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">Perhaps the maximum should be increased.</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">While testing this I also noticed a strange behavior. Sometimes GetLastError..() returned a failure and sometimes it did not. When not calling layer.GetSpatialRef() before calling GetNextFeature() the first time no failure was returned although it still of course had problems reading the sbn and “hSBN->sHooks.Error( szErrorMsg );” was still called.</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><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 happens with the current development Version, but is also there in the 1.10.0 Version.</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">Best Regards,</font></span></div><font color="#000000" face="Times New Roman" size="3"></font><p class="MsoNormal" style="margin:0cm 0cm 0pt">
<font color="#000000"><span lang="EN-US" style="font-family:"Calibri","sans-serif";font-size:11pt">Dennis</span><span style="font-family:"Calibri","sans-serif";font-size:11pt"></span></font></p>
</div>