Bug report #14711
Disappearing polygons after save
|Affected QGIS version:||2.14.0||Regression?:||No|
|Operating System:||Windows||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||22672|
On several occasions now, after saving a range of different types of shapefile edits, all of the features in the layer have disappeared from the canvas and the attribute table. Packed versions of the shp and shx files have usually but not always been created in the source folder. If I rename and open the packed shapefile it is missing not all but some features, unrelated to the recent edits. Other colleagues using 2.14 have had the same issue with different projects and files.
#3 Updated by Jamie Portman almost 4 years ago
I am experiencing the same issue.
There are no index files for the shapefiles being used.
The objects do not just disappear visually on the map, they are completely removed from the attribute table (dbf).
So far cannot pinpoint any exact steps to reproduce the issue, except that it only appear to occur when a record is deleted (either from deletion, merging of two objects, splitting of an object into 2, cut&paste).
#5 Updated by Giovanni Manghi almost 4 years ago
- Status changed from Feedback to Closed
- Resolution set to fixed/implemented
Closing for lack of feedback, please reopen if necessary.
Recently here have also more fixes about similar problems in shapefiles, you may want to try qgis master and check if this issue is also fixed.
#6 Updated by Jamie Portman over 3 years ago
- Status changed from Closed to Reopened
Apologies for the lack of feedback - our IT department uninstalled 2.14.0 from us as it was not the LTR and not due to be for some months - apparently they don't see the need to test!
Latest occurrence tested and replicated in the LTR - v2.14.4.
We have been able to determine a reproducible series of steps for when this happens -
I can have a shapefile open, and be editing away - adjusting shapes, deleting, merging, etc. No issues.
Then, create a duplicate copy of the layer for some other visual effect (DEFINATELY NOT IN EDIT MODE... just Open).
Continue editing ONE of the versions of the shapefile, and as soon as I click save-edits, the file is corrupted (a message is seen across the top saying it can no longer open the table) and the .SHP and .SHX have "_packed" copies created.
Sometimes, the file can be recovered by closing QGIS, deleting the original .SHP and .SHX and renaming the "_packed" versions to the original name.
However this does not always work. Sometimes there is a resulting mis-match in the count of objects between the DBF and SHX and the shapefile is completed ruined.
In previous versions we never had any issues with editing a layer when there were duplicates of the layer open (as long as only 1 was ever in EDIT mode... obviously if both are attempted to be edited, corruption was seen).
We have many project templates for creating complex plans that often have many version of the same layer open so that different plans can all be generated from the same project, each highlighting different components or styling on different layers.
If there is no way to resolve the problem, there should at least be a warning message, or QGIS should prevent a user from editing a layer if more than one copy of it is open in the project. As much as we can warn and tell users not to edit when there is a duplicate copy open, undoubtedly corruption will happen without in-built warnings or edit-prevention.
#7 Updated by Jamie Portman over 3 years ago
In addition, the "_packed" files are not always seen, and while the Shapefile appears OK, it is clear when adding/merging objects that the attributes are not being saved correctly. I suspected a mis-match in the DBF to the SHP files, and so attempted a conversion to another file format using FME Translator...
This was the resulting message -
MapInfo File 'C:\\temp\\test_duplicatedfilesopen.tab' successfully opened for output
Shape file 'C:\\temp\\test_duplicatedfilesopen' does not follow Shape specification. Content Length is wrong
Performing auto-compensation to correct
Shape index file does not match Shape data file contents for dataset 'C:\\temp\\test_duplicatedfilesopen'. Ignoring invalid indexes
DBF Reader: Skipped 19 deleted record(s) found in file 'C:\\temp\\test_duplicatedfilesopen.dbf'
Shape Reader: Shape file and DBF do not match 'C:\\temp\\test_duplicatedfilesopen'. The DBF file seems to contain less records than the Shape file
Suspicion confirmed, so this time, there are no messages and the users thinks the file is fine, however the DBF is now corruption and the addition/deletion/merging of any features results in incorrect attributes being assigned to the object.
#9 Updated by Ine Schockaert 12 months ago
I would like to reopen this issue.
Random polygons in my shapefile are dissapearing from my file when saving my polygon edits.
They still exist in the attribute table, but they are gone from my view.
When using the attribute table to find the polygons that dissapeared, I get the error that the item could not be located.
I'm using QGis Desktop 3.6.2
I tried to save my shapefile on my C-drive, this did not solve the issue.