2

We seem to have come across an issue whereby a Shapefile that has been created/edited with previous versions of QGIS and has phantom (deleted) features, as discussed/resolved in Bug Report 11007, now edited in the current LTR (v2.14.5) becomes totally corrupted upon saving edits.

Upon saving, some of the deleted features reappear, others disappear and attributes become totally jumbled and attached to different objects in the table.

I have tried opening the layer, enabling editing, adding a feature and saving edits, removing the layer from the project and then re-adding, but this DOES NOT 'pack' the table and clean out the deleted features. Nothing I have tried except the trusty old 'save-as' of the entire layer, cleans it and reduces the feature count to the correct number of features. Without doing a save-as, if a new feature is deleted, or a node added to an existing feature (or an edit such as a cut or merge of features), then as soon as the edits are saved, a "_packed" version of the SHX and SHP is created and the shapefile that remains is corrupted.

Has anyone found a successful method to clean a shapefile without having to do a 'save-as' of every layer we have ever edited in QGIS?

  • 2
    This would probably be better posted as a bug report. – BradHards Aug 8 '16 at 5:23
  • Re-writing all your shapefiles as a batch with ogr2ogr should be at least reliable and fast. – user30184 Aug 8 '16 at 6:24
  • Can you point us to a shapefile with some phantom (deleted) features? I'm not sure how to create one. – Spacedman Aug 8 '16 at 7:19
  • I do not know how to do it, but the thing to do is to set some delete flag bytes in the dbf file into asterisk (0x2A). See dbfmanager.com/dbf-file-structure and stackoverflow.com/questions/1888583/… – user30184 Aug 8 '16 at 8:39
  • Technically, the shapefile format does not honor the concept of marking a feature as deleted, so closing a shapefile set with the dBase deletion flag in place is actually the step which corrupts the shapefile. – Vince Aug 8 '16 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.