[gdal-dev] delete feature without fid

Imran Rajjad rajjad at gmail.com
Thu Feb 2 01:59:17 EST 2012


hi list,

in the gdal java bindings I need to delete a feature from layer, but it
seems the only way to delete the feature is its FID, which in my case is
unknown. Is there anyway to find the true FID of a feature in layer or
remove a feature by reference just like it can be updated or re-written.

my code ..


Feature f = layer.GetFeature(i); // i is index of loop that runs till total
feature count

g=f.GetGeometryRef();

layer.SetSpatialFilter(g); //reducing layer content to features with same
geom...here its a point

Feature comparefeature = layer.GetNextFeature();

*do*{

*if*(!f.Equal(comparefeature))

{

comparefeature.delete(); // not the right method...

delcount++;

}

 comparefeature = layer.GetNextFeature();

}*while*(comparefeature!=*null*);

layer.ResetReading();

layer.SetSpatialFilter(*null*); //remove spatial filter
-----------------------
regards,
Imran

-- 
I.R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120202/e09a5b73/attachment.html


More information about the gdal-dev mailing list