<div dir="ltr"><div>Hi Even,</div><div> </div><div>Thanks for the quick reply.</div><div> </div><div>regarding the last part:</div><div>Here is some pseudo code to illustrate:</div><div>I'm normally using the C# wrapper so Failures result in an exception.</div>
<div> </div><div>When doing the following:</div><div>OpenShape()</div><div>GetSpatRef()</div><div>SetSpatialFilter()</div><div>GetNextFeature() -> Exception "Invalid node descriptor size in .sbn"</div><div> </div>
<div>when doing the same just without GetSpatRef():</div><div><div>OpenShape()</div><div>SetSpatialFilter()</div><div>GetNextFeature() -> No Exception</div></div><div> </div><div>This seemed strange to me.</div><div> </div>
<div>With the increased Maximum value it is probably unlikely that this will still happen, but should this Problem with the SBN really result in a Failure or wouldn't be a Warning enough?</div><div> </div><div>Kind regards,</div>
<div>Dennis</div><div> </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 12, 2014 at 2:53 PM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@mines-paris.org" target="_blank">even.rouault@mines-paris.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le mercredi 12 février 2014 13:40:38, Dennis Gocke a écrit :<br>
> Hi,<br>
><br>
><br>
><br>
> I found a problem with the shape file driver that occurs when reading<br>
> features with a spatial filter from a large shapefile that has a spatial<br>
> index (sbn).<br>
><br>
><br>
><br>
> The problem can be reproduced with this shapefile<br>
> <a href="http://geofuse.geoeye.com/static/shp/GE1_2012.zip" target="_blank">http://geofuse.geoeye.com/static/shp/GE1_2012.zip</a> but it's not only this<br>
> shapefile, I have others that show the problem, all of them are rather big.<br>
> Recalculating the spatial index (with ArcGIS) doesn't solve the problem,<br>
> the files seem to be valid.<br>
><br>
><br>
><br>
> When calling CPLGetLastError..() after the first GetNextFeature() a failure<br>
> is returned with the message "Invalid node descriptor size in .sbn :<br>
> 503800".<br>
><br>
> It seems one could just ignore the Failure and continue reading the<br>
> features. Everything seems fine (although it probably did not use the<br>
> spatial index for filtering).<br>
><br>
> Perhaps a Warning instead of a Failure would suffice.<br>
><br>
><br>
><br>
> The error is generated in sbnsearch.c because "nNodeDescCount> nMaxNodes".<br>
> It seems the maximum tree depth of 15 is not enough.<br>
><br>
> Perhaps the maximum should be increased.<br>
<br>
Yes. Fixed by <a href="http://trac.osgeo.org/gdal/ticket/5383" target="_blank">http://trac.osgeo.org/gdal/ticket/5383</a>. The limitation to 15 was<br>
not really justified.<br>
<br>
><br>
><br>
><br>
> While testing this I also noticed a strange behavior. Sometimes<br>
> GetLastError..() returned a failure and sometimes it did not. When not<br>
> calling layer.GetSpatialRef() before calling GetNextFeature() the first<br>
> time no failure was returned although it still of course had problems<br>
> reading the sbn and "hSBN->sHooks.Error( szErrorMsg );" was still called.<br>
<br>
Hum not sure to follow you completely. But sometimes the error flag may be<br>
cleared. The first time you call GetSpatialRef() it reads the .prj file and I<br>
can see that for some reason the routine that does it clears the error flag.<br>
<br>
><br>
><br>
> This happens with the current development Version, but is also there in the<br>
> 1.10.0 Version.<br>
><br>
> Best Regards,<br>
><br>
> Dennis<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Geospatial professional services<br>
<a href="http://even.rouault.free.fr/services.html" target="_blank">http://even.rouault.free.fr/services.html</a><br>
</font></span></blockquote></div><br></div>