[QGIS-Developer] QgsRasterLayer is very slow for rasters with a higher number of bands
Benjamin Jakimow
benjamin.jakimow at geo.hu-berlin.de
Fri Jul 22 07:10:57 PDT 2022
Dear all,
it seems that QGIS has big problems to load rasters with a higher number
of bands. De facto users cannot visualize data from hyperspectral
satellites like EnMAP, DESIS or the CHIME in a responsive way.
In my case I tried to load an AVIRIS-NG image (425 bands x 1673 height x
649 width, float, interlave=band) into QGIS. It took me more than half a
minute until it appeared in the layers list and a much more time until
it was rendered. In comparison, ArcMap showa the image almost immediately.
I did some benchmarks to compare how fast 1673x649 px images get loaded
using plain GDAL and a QgsRasterLayer:
(a) ang_bsq_3bands.tif - 16 MB, a 3 band subset
(b) ang_bsq_425bands.tif – 2.3 GB, all 425 bands
I don’t care about some milliseconds difference, but it shows that even
the creation of the QgsRasterLayer is very very slow.
ang_bsq_3bands
ang_bsq_425bands
/Initialize Dataset / QgsRasterLayer/
gdal.Open(path)
34 ms
16 ms
QgsRasterLayer(path) (1)
2462 ms
70247 ms
QgsRasterLayer(path) (2)
1348 ms
70048 ms
/Load a random single band/
gdal.Band.ReadAsArray()
63 ms
72 ms
layer.dataProvider().block(b, …) (1)
206 ms
57013 ms
layer.dataProvider().block(b, …) (2)
163 ms
70915 ms
(1)Using QgsRasterLayer.LayerOptions(loadDefaultStyle=False)
(2)Using QgsRasterLayer.LayerOptions(loadDefaultStyle=True)
Both images and my benchmark.py are available here:
https://box.hu-berlin.de/d/c688ab6a8545414aaa16/
The original image (ang20180702t105516_rdn_v2q2) with line-interleave
can be downloaded from the AVIRS-NG data portal
https://avirisng.jpl.nasa.gov/dataportal/
Maybe I have used the QGIS API in a wrong way or simply need to deactive
a QGIS setting and everything becomes fine, but so far I could'nt find
such a setting.
Should I open a github issue for that?
Greetings,
Benjamin
--
Benjamin Jakimow, Doctoral Researcher
Earth Observation Lab | Geography Department | Humboldt-Universität zu Berlin
e-mail:benjamin.jakimow at geo.hu-berlin.de
phone: +49 (0) 30 2093 6846
mobile: +49 (0) 157 5656 8477
fax: +49 (0) 30 2093 6848
mail: Unter den Linden 6 | 10099 Berlin | Germany
room: 2'211
web:https://hu-berlin.de/eo-lab
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220722/431354e0/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5457 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220722/431354e0/attachment-0001.bin>
More information about the QGIS-Developer
mailing list