[gdal-dev] Invalid node descriptor size in .sbn

Dennis Gocke dengo at gmx.net
Wed Feb 12 04:40:38 PST 2014


Hi,



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).



The problem can be reproduced with this shapefile
http://geofuse.geoeye.com/static/shp/GE1_2012.zip 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.



When calling CPLGetLastError..() after the first GetNextFeature() a failure
is returned with the message "Invalid node descriptor size in .sbn :
503800".

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).

Perhaps a Warning instead of a Failure would suffice.



The error is generated in sbnsearch.c because "nNodeDescCount> nMaxNodes".
It seems the maximum tree depth of 15 is not enough.

Perhaps the maximum should be increased.



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.


This happens with the current development Version, but is also there in the
1.10.0 Version.

Best Regards,

Dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140212/6de11dc1/attachment-0001.html>


More information about the gdal-dev mailing list