[QGIS-Developer] QBrowser, QgsGdalLayerItems, QgsOgrLayerItems and non valid layers

Richard Duivenvoorde rdmailings at duif.net
Fri Jul 7 03:44:00 PDT 2017


Hi Devs,

using the Qbrowser-widget (and new load it all button) here.
In my testdata directory it is showing some (GDAL) layers as layers, but
upon loading they fail.

Some examples:
- /initrd.img
ERROR 4: `/initrd.img' not recognized as a supported file format.
- a prov.gpkg throws errors but shows it as a raster file:
ERROR 4: `/home/richard/geodata/prov.gpkg' not recognized as a supported
file format.
The same by the way for OGR layers like pdf which appear as vectors.

Trying to look into it, I see that in the QgsGdalLayerItem constructor
QGIS tries top use GDALOpen on those files, and acutally failing!

When it succeeds it adds some capabilities, but if it fails it just
returns it as a valid QgsLayerItem which then is shown in the browser tree.

Is there a way to tell QGIS or the Browser that a
QgsLayerItem/QgsDataItem just is not valid? So here:
https://github.com/qgis/QGIS/blob/master/src/providers/gdal/qgsgdaldataitems.cpp#L49
you can set a flag False or Error or something like that?

Now I often end up with non valid items in the browsertree:

- pdf's which appear as vector and fail to load
- gpkg's without raster which appear as raster and fail to load
- sqlite's without raster which appear as raster and fail to load

And often I see the 'busy' icon of my browser keep spinning in a
directory which has this kind of files, and my cpu goes to 100%

IF we give the browser a more prominent place in QGIS (like we do now
with the 'onebuttonwhichloadsthemall') we should make this work as good
as possible.

Regards,

Richard Duivenvoorde





More information about the QGIS-Developer mailing list