[Qgis-user] qgis python script, add raster to bottom of map

tim dunlevie tim.dunlevie5 at gmail.com
Mon Nov 1 22:20:15 PDT 2021


Hi all,

I have an index of rasters.
I have added an action to the QGIS dataset which will open the raster
directly into QGIS.

The script I use is this:

from qgis.utils import iface
qgis.utils.iface.addRasterLayer('[% path %]')
index =
QgsProject.instance().mapLayersByName('Catalogue_Raster_Aerial_Photography')[0]
iface.setActiveLayer(index)

It works well, except the raster loads to the 'top' of the layer list.
Is there a command to use so that the image loads to the bottom of the map?
I prefer to have my index always on top of the list.

thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20211102/fcf2a86f/attachment.html>


More information about the Qgis-user mailing list