I've committed a newbie error it seems in GQIS with a polygon shapefile.

I wanted to remove about 15 of the 210 polygons, and put those 15 in another file.

I made a duplicate of the polygon shapefile. In the duplicate file I removed everything from the attributes table, started cutting and pasting lines from the original to duplicate file attribute tables. I saved the edits in duplicate with the 15 polygons, gave it a new name. I tried to save the edits in the original now with 195 polygons, wouldn't let me. I made another copy of that original, but it only had the 15 removed polygons. Started closing error messages, thinking it would allow me to save. I tried closing edits of the original, I selected discard changes. All remaining 195 polygons dissapeared, all 15 polygons removed are now present. Closed project without saving changes, but alas the shapefile had been saved. The cpg, prj and qpg files seem unchanged with the original date, so I copied those for safekeeping. Loading the project again it comes back with the 195 polygons missing (about 8 hours work).

Is this a lost cause or is there a way to recover them?

  • 2
    Most likely, you will have to request the source file again and no longer perform the wrong actions ... Commented Jun 19, 2019 at 12:07
  • if you are on windows try right click on the .shp (or folder containing it) then select properties and look at the "previous version" tab, depending on your setting you may be able to retrieve and older version from before the mistake...
    – J.R
    Commented Jun 19, 2019 at 12:46
  • unfortunately i made the source file.... Commented Jun 19, 2019 at 13:04
  • good idea about the previous version, but unfortunately there were none available Commented Jun 19, 2019 at 13:04
  • 1
    Unfortunately, when you modify data without a backup, you run the risk of losing work. Heck, even without modification, you still run that risk (disks are prone to failure, after all). Which just emphasizes the importance of a good backup scheme (with occasional validation tests).
    – Vince
    Commented Jun 19, 2019 at 13:47

1 Answer 1


Duplicating a layer is not the same as making a copy of the source data.

Duplicating a layer

When you duplicate a layer, QGIS creates a second link to the same source file. Any edits you make to the duplicate layer are made to the source file. Any layers that link to that same source file will also have those changes.

To duplicate a layer, right click on the layer name in the layer panel > duplicate layer.

enter image description here

In newer versions of QGIS (eg 3.4), a warning will pop up which says,

Layer duplication complete: Note that it's using the same data source.

enter image description here

The "duplicate" layer will be called "original_layer_name copy."

Making a copy of a layer, AKA backing up your data

In order to actually back up the source data, you must create a copy of the source file.

Right click on the layer name in the layer panel > Export > Save features as...

enter image description here

enter image description here

If you duplicated your layer instead of backing up the source data, then you're stuck with the results of any edits you made to the duplicate layer. Your 195 deleted polygons are gone. I'm genuinely sorry.

Every GIS user learns this lesson one way or another. The lucky ones were taught this by a more experienced GIS user, or we learned it by losing only a small amount of data. Unfortunately you learned it in a particularly painful way, by losing a large amount of unique data.

  • cheers, thanks for the explication, much appreciated. I don't think i'll make this mistake again! Commented Jun 19, 2019 at 19:02

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.