[QGIS-Developer] Loading multiple raster images from processing algorithm

Andrea Giudiceandrea andreaerdna at libero.it
Thu Mar 11 13:55:39 PST 2021


C Hamilton wrote
> path = path_to_the_image
> rlayer = QgsRasterLayer(path, name_of_image)

Hi C Hamilton,
are you sure the path_to_the_image is correct? Have you tried to execute the
code in the Python console? Does QgsRasterLayer(path, name_of_image) and
QgsProject.instance().addMapLayer(rlayer, True) return a valid
<QgsRasterLayer: name_of_image (gdal)> object?

I usually use the same code without issue: the layer is correctly added to
the map and it is listed in the layer tree.

Regards.

Andrea



--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html


More information about the QGIS-Developer mailing list