Bug report #828
Features cannot be cut or deleted when using shapefile data.
|Affected QGIS version:||Regression?:||No|
|Operating System:||OS X||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||duplicate|
|Crashes QGIS or corrupts data:||Copied to github as #:||10887|
Features cannot be cut or deleted when using shapefile data. Other data types have not been tested.
If you try to delete a feature (by Toggle Editing, Select Features, drawing a small box around the feature to select it, Cut Features, Toggle Editing), the feature will disappear from the screen, but QGIS also deletes something it shouldn’t – the dbf file. If you then close the map and reopen it, the feature will reappear. If you try and delete the feature a second time, QGIS will crash.
#1 Updated by gburns - over 13 years ago
I'm new to QGIS so take everything I say with a grain of salt. However, after a dozen hours of testing why a basic function like Cut Features was not working, this is what I discovered. I may be wrong in my explanation, or I may be doing something incorrect.
1. I have an external firewire drive on which I have OSX. Call it A-Drive. I have a shapefile folder called TEST on this drive in which there is a file called TEST.dbf. This file, and the other three files in the folder (.shp, .prj, .shx) define five points.
2. I have another external firewire drive, called B-drive, to which I installed QGIS. So, I have a QGIS data file on one drive, and QGIS itself on another.
3. I opened QGIS and added the TEST layer. Five points appeared.
4. I deleted one of the points and it disappeared.5. I saved the project on A-Drive, shut down QGIS, opened the project again. This is what happened:
- the deleted point was still there
- the TEST.dbf file was gone (only three files now in the TEST folder)
- all the attributes for the five points had gone
- a new file called TEST_packed.dbf appeared on B-drive (in the same directory as QGIS).
6. When I tried to cut the point that had reappeared a second time, QGIS crashed.
7. I reversed everything, thinking that maybe QGIS has to be in the Applications folder. I installed QGIS into the Applications folder on A-Drive and created a new TEST folder on B-Drive. I went through the same procedure as above. Once again, a new file called TEST_packed.dbf was created, but this time in the Applications folder (where QGIS now resided), and TEST.dbf was deleted from the TEST folder on B-Drive.
8. To confirm that Delete and Cut Features only work if QGIS and it's data are on the same drive, I put both on A-Drive, and then both on B-Drive. Everything worked.
9. I still wasn't convinced that such a basic flaw would exist with QGIS, so I reinstalled OSX onto my internal drive, reinstalled QGIS from the zip file, and the same thing happened.
My explanation is this: when I cut the point and saved it, QGIS expected the data it was working with (TEST folder) to be on the same drive. When it couldn't find the TEST folder to update the shapefiles, for some reason QGIS saved a thing called TEST_packed.dbf in the same directory (or folder) as itself, and deleted the original dbf file.
To sum up:
If QGIS and your data are on the same drive:_ Cut Features_ and Delete work correctly.
If QGIS and your data are on the different drives: Cut Features and Delete do not work.
I consider that some warning be given in the READ ME file that comes with QGIS, along the lines of: "QGIS and your data must be on the same drive, otherwise some features won't work".