I have some shapefiles. They have associated .dbf files with them that contain many many rows of data corresponding to objects that were clipped from an earlier file.
How can I use Python to clean up the .dbf file to remove the orphaned entries?
<edit 1> I don't think my files are corrupt. They just contain features with no extents along with the extant features.
- open the file in QGIS and manually select extant features using the "select features by area" tool
- Open the attribute table
- Invert the selection
- delete the orphaned features
What I can't do, is do this in any reasonably automated way, such as pyQGIS
Simply opening and saving the does not remove the orphaned features
<edit 2> I tried to run a query to generate non NULL entries in a column of the attribute table but can't seem to generate non NULLS for the extant features. - I'll keep trying. If I get that to work I can look up a method to select on that and then delete the "non" features