In QGIS 2.12 carrying out the following steps leads to unexpected results. I wonder if anyone can shed some light on this.

  1. Copy a layer from a previous project to a new project using Windows Explorer copy and paste of all layer files (dbf, prj, qpj, shp, shx).

  2. Delete the polygons in the new project, make some new polygons in different locations and save.

  3. Paste some data into the .dbf file of the new layer (being careful not to re-arrange the order of the polygons)

Returning to QGIS, the polygons have all reverted to their previous locations, this despite them being deleted, re-drawn and saved.

This is not consistently replicable, but I've not been able to work out what it is about the projects that do this.

Any ideas where QGIS is storing the locations of the old polygons so that I can clear this 'cache', or why it's doing this at all?


I've gone through a simplified set of steps to clarify the issue. Copy an entire project, including it's layers to another folder. Open one of the layers and delete the polygons. Save the changes, close the project. Open that layer's .dbf file, make one small change (I added the letter 'a' to a text column), save. Re-open the project - all the polygons have reverted to their previous locations before being deleted (even though I saved the deletion). How does QGIS know where the polygons used to be?

Edit 2

Sorry for the long edit, but this is really weird - Open the .dbf in OpenOffice Calc it has just the new polygons, open it in OpenOffice Base (which deals with dBase files) and it has just the new polygons. Open it in WPS (Excel equivalent), and all the old polygons are still there despite being deleted and saved twice!

Just to save anyone the bother, I've written this one off as a bug in QGIS, and so not really suitable for this forum.

The final proof - I loaded the offending layer in a friend's ArcGIS, all the polygons are still there, despite being deleted in QGIS twice.

  • 1
    The .dbf file basically contains the data which you can see in the Attributes Table (not advisable to edit). The .shp file contains the geometry data which is used to project features (points, lines, polygons etc). Are you sure the new project is not loading the old shapefile?
    – Joseph
    Commented Nov 12, 2015 at 12:07
  • I can only imagine that it comes from the possibility to delete features from shapefile only by flagging them deleted in the .dbf file. The .shp and .shx parts are not modified. If the flag from the .dbf gets removed from some reason the features will come back because they were never really wiped out. This should not happen if you save the edited shapefile into a new one because then the features which are flagged as deleted are not written into .shp and .shx either. There have been some QGIS bug reports about same kind of issues.
    – user30184
    Commented Nov 13, 2015 at 1:15
  • Joseph - Yes, I checked that the new project is pointing to the shapefile in it's folder (my references are all relative). On the subject of editing the .dbf, I know one has to be careful, but I have to add a considerable amount of data to layers for work, if, instead of cutting and pasting the data directly onto the .dbf, I added it one item at a time in Qgis, I would very quickly lose my job!
    – user39790
    Commented Nov 13, 2015 at 7:54
  • 1
    I can not really figure out why you should ever want to open and manipulate the dbf of a shapefile manually. Better rethink your workflows (not copy files, but load layer in new project or embed layer from old project and copy, then manipulate etc..).
    – Bernd V.
    Commented Nov 13, 2015 at 9:32
  • Probably worthy of a discussion in it's own right, but basically Qgis lacks a good function to attach large quantities of data to polygons. Re-saving, loading or embedding layers does not carry any virtual field with it (I use 25 virtual fields with this dataset, I can't re-write them all). Joining csv layers does not allow for editing of data later on within Qgis. Merging csv's creates new column headers which then don't work with virtual fields etc.... Pasting directly into the .dbf is the only efficient way to do it, I wish it weren't, but it is.
    – user39790
    Commented Nov 13, 2015 at 11:32

2 Answers 2


Yes, 'phantom' deleted polygons is a bug in QGIS - see this bug report 11007. Not only do they show up in other programs, but they can cause some very odd behaviour in QGIS itself.


I have experienced this same issue when deleting large sections of data from shapefiles.

An easy fix is to select the desired or remaining part of the shapefile and save it to a new shapefile using the Save As tool. That will leave out the old data because you can choose to save only the selected part.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.