<div dir="ltr"><div><div>hi all,<br><br></div>I am trying to delete feature from shape layer using feature id.the feature id is deleted when deleted in order descending order.When trying to delete randomly it is giving error message <br></div>if i delete fid = 1, the below error is shown.<br><div>

<p style="margin:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)">ERROR 1: Attempt to read shape with feature id (2) out of available range.</span></p><p style="margin:0px;text-indent:0px">this is what i am doing <br></p><p style="margin:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)"></span></p><p style="margin:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)"> OGRFeature *delFeatur = poLayer->GetFeature(</span><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)">actualIndex</span><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)">); <br></span></p><p style="margin:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)"> delFeatur->SetGeometryDirectly(NULL);<br>  poLayer->SetFeature(delFeatur);<br>  poLayer->DeleteFeature(actualIndex);</span></p><p style="margin:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)">  OGRFeature::DestroyFeature( delFeatur );<br><br> QString sql = QString( "REPACK %1" ).arg( poLayer->GetName() );<br> reader->ExecuteSQL(sql.toLatin1().data(),NULL,NULL);</span></p><p style="margin:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)">poLayer->SyncToDisk();</span></p><p style="margin:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)">reader->SyncToDisk();</span></p><p style="margin:0px;text-indent:0px"><br><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)"></span></p><p style="margin:0px;text-indent:0px"><br><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)"></span></p><p style="margin:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)">thanks,</span></p><p style="margin:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)">hema<br></span></p><p style="margin:0px;text-indent:0px"><br><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)"></span></p><p style="margin:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:rgb(60,60,60)"><br></span></p><br></div></div>