Bug report #13782

Deleting columns in duplicate layer also deletes them in original layer

Added by Michael Kirk almost 4 years ago. Updated almost 4 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:-
Affected QGIS version:2.12.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:21808

Description

I want to export a subset of my features/attributes to geojson so that I can use them in a web map.

Given I've got a shapefile layer "cities" with attributes "important_stuff" and "irrelevant_stuff"
And I duplicate the layer to "cities_copy"
And I enable edit mode on "cities_copy"
And I open the attribute table for "cities_copy"
And I delete the "irrelevant_stuff" column from "cities_copy"
Then I see only the column "important_stuff" in the cities_copy attributes table (as expected)
And I save "cities_copy" as cities.geojson
Then I see cities.geojson was exported with only the "important_stuff" attribute (as expected!)
When I inspect the attributes table for "cities" I still see "important_stuff" and "irrelevant_stuff" (as expected)

But when I close QGIS and reopen my project
When I inspect the attributes table for "cities"
Then the attribute "irrelevent_stuff" is missing, and I only see "important_stuff" (!!!)

I suspect what's happening is that the layers are sharing a single shapefile storage mechanism, and edits to one of the layers in QGIS do no propagate to the Layer in QGIS (until that layer is reloaded from file).

I'm not exactly sure what I would expect to happen. My immediate thought is that editing should be disabled for duplicate layers until they have their own backend.

If this is expected behavior (that edits in a duplicate layer affect the storage for another layer) than we should consider updating other layers that are backed by this file.

History

#1 Updated by Giovanni Manghi almost 4 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed

"duplicate layer" do not duplicate (create a copy of) the datasource, it just duplicates in the project, the layer is the same.

Also available in: Atom PDF