<div dir="ltr"><div>Wow, that was fast, Thanks.</div><div> </div><div>I just remembered something else I stumbled upon related to the shapefile driver.</div><div> </div><div>It's more of an user/programmer error, but it might be interesting nonetheless.</div>
<div>After deleting features we normally Execute the "REPACK LayerName".</div><div>The problem is that when LayerName is not in the correct case sensitivity, it does not work.</div><div>Which is understandable because on non-windows filesystems there might actually be different files.</div>
<div> </div><div>The funny thing is, when you open the DataSource/Layer with incorrect case sensitivity in the filepath, it first seems that everything is fine, but when you call "REPACK " + layer.GetName() it does not work, because layer.GetName() will return the same wrong case sensitivity that was provided when the DataSource was opened.</div>
<div> </div><div>And there is another thing. Once someone had managed to have the different files belonging to the same shapefile (shp, dbf) in different case sensitivies (e.g. data.shp and DATA.dbf). As above everything except the REPACK seemed to work fine, but the REPACK did not work. I think in this case "REPACK data"/"REPACK DATA" either did nothing like above or it even threw an error. That depended on how the datasource was opened with Open("DATA.shp", 1) or Open("data.shp", 1). But in this case neither combination worked.</div>
<div> </div><div>Let me know if you would like more details on this.</div><div> </div><div>Cheers,</div><div>Dennis</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 5, 2013 at 12:07 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">Selon Dennis Gocke <<a href="mailto:dengo@gmx.net">dengo@gmx.net</a>>:<br>
<div><div class="h5"><br>
> Hi,<br>
><br>
> I've encountered a serious problem with an empty shapefile (no features)<br>
> that already has sbn, sbx files generated. When trying to create a feature<br>
> there is an Access Violation and the program crashes without any chance to<br>
> catch the exception.<br>
> The shapefile was exported with ArcCatalog, but the same happens when<br>
> creating an empty shapefile with OGR and then creating spatial index on it<br>
> with ArcCatalog.<br>
><br>
> Trying "DROP SPATIAL INDEX ON.." in OGR also produces the same crash.<br>
><br>
> When manually deleting the sbn, sbx files before opening the shapefile with<br>
> OGR, everything works fine.<br>
><br>
> I am using the C# wrapper, but I am sure the problem is in OGR itself.<br>
> The lines that can be used to reproduce the crash:<br>
><br>
> 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<br>
><br>
> Using GDAL 1.9.2 does not produce the crash, but this was to be expected<br>
> because 1.9.2 just ignores the spatial index.<br>
><br>
> I've also attached the shapefile. Hopefully this works with the mailing<br>
> list.<br>
<br>
</div></div>Thanks for the precise report. I've managed to reproduce and committed a fix in<br>
r25862.<br>
<br>
><br>
> Regards,<br>
> Dennis<br>
><br>
<br>
<br>
</blockquote></div><br></div>