<div dir="ltr"><div>Hi,</div><div> </div><div>I've encountered a serious problem with an empty shapefile (no features) that already has sbn, sbx files generated. When trying to create a feature there is an Access Violation and the program crashes without any chance to catch the exception.</div>
<div>The shapefile was exported with ArcCatalog, but the same happens when creating an empty shapefile with OGR and then creating spatial index on it with ArcCatalog.</div><div> </div><div>Trying "DROP SPATIAL INDEX ON.." in OGR also produces the same crash.</div>
<div> </div><div>When manually deleting the sbn, sbx files before opening the shapefile with OGR, everything works fine.</div><div> </div><div>I am using the C# wrapper, but I am sure the problem is in OGR itself.</div><div>
The lines that can be used to reproduce the crash:</div><div> </div><div>DataSource ds = Ogr.Open(@"D:\test\IndustryA_O.shp", 1);<br>Layer layer = ds.GetLayerByIndex(0);<br>FeatureDefn featureDefn = layer.GetLayerDefn();<br>
Feature newFeature = new Feature(featureDefn);<br>layer.CreateFeature(newFeature); // <-- Crash</div><div> </div><div>Using GDAL 1.9.2 does not produce the crash, but this was to be expected because 1.9.2 just ignores the spatial index.</div>
<div> </div><div>I've also attached the shapefile. Hopefully this works with the mailing list.</div><div> </div><div>Regards,</div><div>Dennis</div></div>