Bug report #19885

Using the Browser panel layers are added by layerid

Added by Douglas Alderman over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:Even Rouault
Category:Data Provider/OGR
Affected QGIS version:3.2.2 Regression?:No
Operating System:Windows 7 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27709

Description

new description:

#19885-11

old description:

This is an old issue I reported in June 2018 that I was informed was fixed in QGIS 3. However, I am still having the issue in QGIS 3.2. I tried to find the closed issue #18081, but I cannot find it to reopen it. Therefore, I am opening a new issue.

Issue: I open a new project, add several layers from an ArcGIS GDB. Then work in the project for a while. When I close the project and reopen it later the GDB layers are there, but they may or may not be referencing the correct layer from the GDB. My Covertypes layer could be mapping the Powerline layer or some other layer. It also references the incorrect Attribute Table. I have attached 2 screenshots. The first is what the GDB layer and Attribute Table should look like. The second is the incorrect data it is referencing. I do contract work for a company that uses Arc GIS. The GDB was created by them in Arc and sent to me via Dropbox. I have downloaded the GDB from dropbox to my Desktop for use in QGIS.

Screenshot 2018-09-18 11.45.19.png - It should look like this (323 KB) Douglas Alderman, 2018-09-18 06:07 PM

Screenshot 2018-09-18 11.27.15.png - but it looks like this (345 KB) Douglas Alderman, 2018-09-18 06:08 PM

Screenshot 2018-09-20 15.53.33.png (761 KB) Douglas Alderman, 2018-09-20 10:09 PM


Related issues

Related to QGIS Application - Bug report #16135: Selection by layerid instead layername from .gdb Closed 2017-01-30
Related to QGIS Application - Bug report #20031: The only layer contained in a singlelayer GPKG / SQLite /... Closed 2018-10-05
Duplicates QGIS Application - Bug report #18081: GDB recognition mixup Closed 2018-02-12

Associated revisions

Revision 9e9ddb58
Added by Even Rouault over 5 years ago

SIP: fix typemap for QVector<Type*> that was wrongly dropping a Python reference (refs #19885)

Revision ea2cc365
Added by Even Rouault over 5 years ago

[OGR provider] Make sure to use layername= syntax in URI of multilayer datasources (fixes #19885)

Revision bb40385d
Added by Even Rouault over 5 years ago

Merge pull request #7977 from rouault/fix_ogrdataitems_layername

[OGR provider] Make sure to use layername= syntax in URI of multilayer datasources (fixes #19885)

History

#1 Updated by Giovanni Manghi over 5 years ago

  • Status changed from Open to Feedback
  • Category changed from Unknown to Vectors

Can you share the data or provide a freely available dataset where is possible to see the same issue?

#2 Updated by Jürgen Fischer over 5 years ago

  • Description updated (diff)

#3 Updated by Jürgen Fischer over 5 years ago

#4 Updated by Douglas Alderman over 5 years ago

I can supply the GDB, but the file is too big to send it through this website. Do you have an email address where I could send you a link to the data via Dropbox? Thanks!

#5 Updated by Giovanni Manghi over 5 years ago

Douglas Alderman wrote:

I can supply the GDB, but the file is too big to send it through this website. Do you have an email address where I could send you a link to the data via Dropbox? Thanks!

giovanni dot manghi at gmail dot com

#6 Updated by Douglas Alderman over 5 years ago

The dropbox link has been sent.

Please note, I create groups in the 'Layers' panel of QGIS such as "App A GDB", "App B GDB", "Oak Hill GDB", etc. Then I add the layers from the GDB under the appropriate group. Then I usually shorten the name of the layer via the 'Settings' page of the 'Layer Properties' window so that I can see the name of the layer in the 'Layers' panel
(i.e., QGIS adds the layer as "Update_Current_09192018 Appalachian_Forest_A_Ownership", but I change it to "App A Ownership").

I may open the same project for many days before it ever glitches on me, but eventually, it glitches.

Hope this helps!

#7 Updated by Giovanni Manghi over 5 years ago

Douglas Alderman wrote:

The dropbox link has been sent.

Please note, I create groups in the 'Layers' panel of QGIS such as "App A GDB", "App B GDB", "Oak Hill GDB", etc. Then I add the layers from the GDB under the appropriate group. Then I usually shorten the name of the layer via the 'Settings' page of the 'Layer Properties' window so that I can see the name of the layer in the 'Layers' panel
(i.e., QGIS adds the layer as "Update_Current_09192018 Appalachian_Forest_A_Ownership", but I change it to "App A Ownership").

can you provide the project file then?

I may open the same project for many days before it ever glitches on me, but eventually, it glitches.

well... I can try for a few minutes...

#8 Updated by Giovanni Manghi over 5 years ago

Douglas Alderman wrote:

The dropbox link has been sent.

Please note, I create groups in the 'Layers' panel of QGIS such as "App A GDB", "App B GDB", "Oak Hill GDB", etc. Then I add the layers from the GDB under the appropriate group. Then I usually shorten the name of the layer via the 'Settings' page of the 'Layer Properties' window so that I can see the name of the layer in the 'Layers' panel
(i.e., QGIS adds the layer as "Update_Current_09192018 Appalachian_Forest_A_Ownership", but I change it to "App A Ownership").

I may open the same project for many days before it ever glitches on me, but eventually, it glitches.

Hope this helps!

I can't trigger the problem with just only the data, maybe the project is also important, better share it too.

#9 Updated by Douglas Alderman over 5 years ago

The project was sent via the email address above. To use the project as is, download the GDB to your desktop and change the name of the folder to "Update_Current.gdb". There are several of the layers in the project that you will not have though because I use several topo layers and aerial imagery and other layers that are stored in several different places on my computer. I only remember having issues with GDB layers. I do not remember ever having this issue with any other files types that I import as layers. I don't know how to trigger it. One day I open the project and there it is. It may be one layer or multiple layers, but I do not remember it ever being all of the layers from the GDB. If I remember correctly, I have only had the issue about twice since I upgraded to QGIS 3 in February or March 2018. If it ever happens again, I will try to see if I can send you the project with the bad reference layer before I correct it. Unfortunately, I have already corrected the corrupt layer in the attached project by removing it and adding the layer again. When I was having the issue in QGIS 2.8 I would correct it, but eventually, it would happen again.

#10 Updated by Andrea Giudiceandrea over 5 years ago

  • Related to Bug report #16135: Selection by layerid instead layername from .gdb added

#11 Updated by Andrea Giudiceandrea over 5 years ago

Douglas, did you add the layers using the Browser panel or using the Data Source Manager?

It seems that using the Data Source Manager, a layer from an Esri Filegeodatabase is added by layername as

path\filegdbname.gdb|layername=Layer_name

Using the Browser panel, the same layer is added by layerid like

path\filegdbname.gdb|layerid=2

Adding layers by layerid is bad because it leads to this kind of "layer mixup" in QGIS projects (see also #16135 and #18081#note-8).

The Browser panel incorrect behaviour should be fixed.

Anyway, if the layers source string are saved in the project by |layerid= instead of by |layername=, fixing the code will not fix your project. You should re add again the layers (or change the datasource programmatically) ensuring that the |layername= is present instead of |layerid=.

#12 Updated by Giovanni Manghi over 5 years ago

  • Description updated (diff)
  • Status changed from Feedback to Open
  • Category changed from Vectors to Browser
  • Subject changed from GDB recognition mixup to Using the Browser panel layers are added by layerid

Andrea Giudiceandrea wrote:

Using the Browser panel, the same layer is added by layerid like
[...]

Adding layers by layerid is bad because it leads to this kind of "layer mixup" in QGIS projects (see also #16135 and #18081#note-8).

The Browser panel incorrect behaviour should be fixed.

good catch!

#13 Updated by Douglas Alderman over 5 years ago

I do not ever remember uploading GDB layers from the Browser Panel. I thought I had always used the Data Source Manager. However, I think the layer I was having issues with was a "layerid" file and not a "layername" file. I have attached a screenshot of the avenue I use to add GDB layers. I am pretty sure it is the Data Source Manager that you refer to. Could you confirm? Also, is there any way I could have loaded the layer as a "layerid" file through the Data Source Manager? In the future, I will try to be sure all files are loaded by "layername" and not "layerid". Thanks for the help!!! No doubt this will save me a bunch of time in the future.

#14 Updated by Douglas Alderman over 5 years ago

I think the problem was fixed in QGIS 3, but I used an old project from QGIS 2 as a base project that likely had the old file path instead of the new file path. It appears I may have wasted your time, but maybe not if it will help others not to load files through the Browser Panel. Also, any old projects created in former versions of QGIS may need attention to change any GDB file paths to "layername" instead of "layerid". I have many projects that are likely to be used again that I created in QGIS 2. I will be aware of this in the future. Thanks again for all the help!!!

#15 Updated by Jürgen Fischer over 5 years ago

  • Description updated (diff)

#16 Updated by Giovanni Manghi over 5 years ago

  • Status changed from Open to Feedback

Douglas Alderman wrote:

I think the problem was fixed in QGIS 3, but I used an old project from QGIS 2 as a base project that likely had the old file path instead of the new file path. It appears I may have wasted your time, but maybe not if it will help others not to load files through the Browser Panel. Also, any old projects created in former versions of QGIS may need attention to change any GDB file paths to "layername" instead of "layerid". I have many projects that are likely to be used again that I created in QGIS 2. I will be aware of this in the future. Thanks again for all the help!!!

the question is, is this still valid then?

#17 Updated by Even Rouault over 5 years ago

  • Assignee set to Even Rouault
  • Category changed from Browser to Data Provider/OGR
  • Status changed from Feedback to Open

Confirmed. Taking care of this

#18 Updated by Even Rouault over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

#19 Updated by Andrea Giudiceandrea over 5 years ago

  • Related to Bug report #20031: The only layer contained in a singlelayer GPKG / SQLite / FileGDB is incorrectly added to the map without "|layername=" in some circumstances added

Also available in: Atom PDF