[gdal-dev] Delete Feature

Hema Yeedunuri hema.yeedunuri at amigooptima.in
Mon Feb 16 01:07:35 PST 2015


hi all,

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
if i delete fid = 1, the below error is shown.

ERROR 1: Attempt to read shape with feature id (2) out of available range.

this is what i am doing

 OGRFeature *delFeatur = poLayer->GetFeature(actualIndex);

 delFeatur->SetGeometryDirectly(NULL);
  poLayer->SetFeature(delFeatur);
  poLayer->DeleteFeature(actualIndex);

  OGRFeature::DestroyFeature( delFeatur );

 QString sql = QString( "REPACK %1" ).arg( poLayer->GetName() );
 reader->ExecuteSQL(sql.toLatin1().data(),NULL,NULL);

poLayer->SyncToDisk();

reader->SyncToDisk();



thanks,

hema
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150216/2a8bad9c/attachment.html>


More information about the gdal-dev mailing list