Thanks a lot for your suggestion Even. That is it. Cheers, Hugo
On Sun, Sep 16, 2012 at 1:40 PM, Even Rouault <even.roua...@mines-paris.org>wrote: > Le samedi 08 septembre 2012 05:06:41, Hugo a écrit : > > Hello all, > > > > I'm trying to delete a number of records from shapefile based on an > > attribute. The strange thing that is happening is that feature count > never > > changes but if i make the same filter a second time the features are no > > longer there. The code i'm using is below. I should be doing something > > wrong for sure. > > I don't think you are doing something wrong. This is just a limitation of > the > implementation of GetFeatureCount() in the shapefile driver. When there > are no > attribute or spatial filter set, it returns the total number of records in > the > DBF file. When you delete a feature, it marks the corresponding record as > invalid, but doesn't actually remove it from the file, so the total number > of > records remains unchanged. You can "repack" the .shp, .shx and .dbf files > by > running shp.ExecuteSQL("REPACK locais") (see > http://gdal.org/ogr/drv_shapefile.html) > -- Hugo Martins
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev