Bug report #13913

Embed layers and groups does not work properly with layer duplicate names

Added by Paolo Cavallini almost 9 years ago. Updated almost 6 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Project Loading/Saving
Affected QGIS version:3.0.0 Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:21935

Description

On QGIS desktop, if I include layers and groups from two different projects, and the layers and groups have the same name, the second project is ignored, and the first layers are loaded twice instead.
I agree that having duplicate names is risky, but:

  • there are legitimate case where this may occur (e.g. several groups with the same internal structure)
  • if this is not allowed, a check should be in place, and the user should be warned not to do it; ideally an automatic renaming mechanism should be offered in the dialog.

ticket_13913.zip (10.8 KB) Paolo Cavallini, 2018-12-28 04:29 PM


Related issues

Related to QGIS Application - Bug report #6686: Embedded layers from projects with groups misbehaving Closed 2012-11-13
Related to QGIS Application - Bug report #9598: problems with adding embed layers/groups Closed 2014-02-18

History

#1 Updated by Sebastian Dietrich almost 9 years ago

Additionally I encountered the following error:
If you have two or more groups with identical names QGIS always embeds the first one, no matter which one you select.

To reproduce:
  • Create a project with a layout like this:
    - group
    -- Layer_X
    - group
    -- Layer_Y
  • Embed the second group, containing Layer_Y.
  • The first group, containing Layer_X, is embedded.

#2 Updated by Sebastian Dietrich almost 9 years ago

  • Affected QGIS version changed from 2.8.3 to master

Importing layers with the same name works for me, as long as they do have different layer-IDs.

If they have the same layer-ID, e.g. because I used Save project as..., embedding does not work, even after renaming the second layer. See #9598.

#3 Updated by Giovanni Manghi over 7 years ago

  • Easy fix? set to No
  • Regression? set to No

#4 Updated by Paolo Cavallini over 6 years ago

  • Regression? changed from No to Yes
  • Affected QGIS version changed from master to 3.0.0
  • Description updated (diff)
In QGIS 3 the situation has apparently got worse:
  • layers with the same name from different project are not loaded
  • styles are not preserved (this could warrant a separate ticket).

#5 Updated by Giovanni Manghi over 6 years ago

  • Priority changed from Normal to High

#6 Updated by Paolo Cavallini almost 6 years ago

  • Status changed from Open to Feedback

Better add sample projects for ease of replication.
Thanks.

#7 Updated by Giovanni Manghi almost 6 years ago

Paolo Cavallini wrote:

Better add sample projects for ease of replication.
Thanks.

Note to yourself? :)

#8 Updated by Paolo Cavallini almost 6 years ago

Apparently this is no longer the case, see attached projects and files.

#9 Updated by Giovanni Manghi almost 6 years ago

  • Resolution set to not reproducable
  • Status changed from Feedback to Closed

#10 Updated by Paolo Cavallini almost 6 years ago

  • Resolution changed from not reproducable to fixed/implemented

Also available in: Atom PDF