<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Tim,</p>
<p>there are multiple options:<br>
</p>
<p>You can consult the QGIS PyQGIS cookbook for an example:
<a class="moz-txt-link-freetext" href="https://docs.qgis.org/3.16/en/docs/pyqgis_developer_cookbook/loadlayer.html#qgsproject-instance">https://docs.qgis.org/3.16/en/docs/pyqgis_developer_cookbook/loadlayer.html#qgsproject-instance</a></p>
<p>Or when you google for "pyqgis add layer" plus "order", "bottom"
or "specific index", those terms should get you going with various
examples at gis.stackexchange.com. Those are for a number of
different use cases so best look around yourself what best suits
you.</p>
<p>Cheers, Hannes<br>
</p>
<div class="moz-cite-prefix">Am 02.11.21 um 06:20 schrieb tim
dunlevie:<br>
</div>
<blockquote type="cite"
cite="mid:CAPSUT_xrHrCPjKGXhUnrp=fB3JOeuu=_YwXxj8N7viSrufx+zA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">Hi all,
<div><br>
</div>
<div>I have an index of rasters.</div>
<div>I have added an action to the QGIS dataset which will
open the raster directly into QGIS.</div>
<div><br>
</div>
<div>The script I use is this:</div>
<div><br>
</div>
<div>
<div>from qgis.utils import iface</div>
<div>qgis.utils.iface.addRasterLayer('[% path %]')</div>
<div>index =
QgsProject.instance().mapLayersByName('Catalogue_Raster_Aerial_Photography')[0]</div>
<div>iface.setActiveLayer(index)</div>
</div>
<div><br>
</div>
<div>It works well, except the raster loads to the 'top' of
the layer list.</div>
<div>Is there a command to use so that the image loads to the
bottom of the map?</div>
<div>I prefer to have my index always on top of the list.</div>
<div><br>
</div>
<div>thanks</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Johannes Kröger / GIS-Entwickler/-Berater
WhereGroup GmbH
Eifelstraße 7
53119 Bonn
Germany
Tel: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11
<a class="moz-txt-link-abbreviated" href="mailto:johannes.kroeger@wheregroup.com">johannes.kroeger@wheregroup.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.wheregroup.com">www.wheregroup.com</a>
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
-------------------------------
---------------------------------------------
Schon gewusst?
In unserem Blog geben wir Tipps & Tricks zu
Open-Source-GIS-Software und berichten aus unserem Experten-Alltag:
<a class="moz-txt-link-freetext" href="https://wheregroup.com/blog/">https://wheregroup.com/blog/</a>
---------------------------------------------
</pre>
</body>
</html>