Bug report #16807

Browser will show non valid files as loadable even when 'checked by GDAL'

Added by Richard Duivenvoorde over 7 years ago. Updated almost 6 years ago.

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

Description

See this thread:
https://lists.osgeo.org/pipermail/qgis-developer/2017-July/049234.html

In short:

Even when selecting 'Check extension' in "Settings/Options/Data Sources/Data source handling/Scan for valid
items in the browser dock" GDAL is used to test if QGIS is able to open certain files in the directories seen in the Browser(widget).

Even though GDAL reports that the file is not openable, the files are still visible in the browser.

From that thread:

Ah indeed you're right, even if we only check by extension, then we end up still opening the file with GDALOpen :-)

"
So we should have either :
- do only extension checking and defer the call to
https://github.com/qgis/QGIS/blob/master/src/providers/gdal/qgsgdaldataitems.cpp#L43 as late as possible. But I'm not sure if that's doable. I am merely discovering this piece of code
- or do extension checking as a pre-filter, but try GDALOpen() to ensure then that the file is a valid candidate. Would seem a more reasonable approach.
"

Another option would be to introduce an icon for each layer type (raster, vector etc) which is 'grayed out' like 'not enabled' to show that: "It is possible that we can open it, but there is also a chance that we fail". For all those cases where the Identify() is not conclusive, OR where the actual opening of the file/connection is just too expensive/complex.

Associated revisions

Revision 2c64cece
Added by Nyall Dawson almost 6 years ago

[browser] Avoid always opening every file using gdal to test for
update capabilities

This is no longer required - it was previously done in order to
detect if the item should expose the SetCrs capability, but
that's deprecated and unused.

Fixes #16807, fixes #20411, and avoids QGIS opening every file encountered in
the browser even when the Data Source setting is set to the
default (fast) "Check Extension" setting only.

Revision 331f590a
Added by Nyall Dawson almost 6 years ago

[browser] Avoid always opening every file using gdal to test for
update capabilities

This is no longer required - it was previously done in order to
detect if the item should expose the SetCrs capability, but
that's deprecated and unused.

Fixes #16807, fixes #20411, and avoids QGIS opening every file encountered in
the browser even when the Data Source setting is set to the
default (fast) "Check Extension" setting only.

(cherry picked from commit 2c64cece0d1a51c37d27c1b11e76d76bb62184f3)

History

#1 Updated by Nyall Dawson almost 6 years ago

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

Also available in: Atom PDF