You can define self.layers on __init__ method this way: <br><br><div style="margin-left: 40px;"><i>self.layers = []</i><br></div><br>And then just add every new layer: <br><br><div style="margin-left: 40px;"><i>self.layers.insert( 0, QgsMapCanvasLayer( newLayer ) )<br>
self.canvas.setLayerSet( self.layers )</i><br></div><br>Regards.<br><br><div class="gmail_quote">2009/11/25 Echavarria Gregory, Maria Angelica <span dir="ltr"><<a href="mailto:m.echavarriagregory@umiami.edu">m.echavarriagregory@umiami.edu</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">>Angelica,<br>
>Try replacing:<br>
>layers = [cl]<br>
>self.canvas.setLayerSet(layers)<br>
>With:<br>
>layers = self.canvas.mapRenderer().layerSet()<br>
>layers.insert(0,cl)<br>
>self.canvas.setLayerSet(layers)<br>
<br>
</div>Aaron, thanks for your answer,<br>
<br>
I tried the replacement you recommended and got a Type error (cl must be QStringList type), then I tried correcting the issue with the following in the vector layer method:<br>
<br>
cl= QgsMapCanvasLayer (layer)<br>
layers = list (self.canvas.mapRenderer ( ).layerSet ( ) )<br>
<div class="im"> layers.insert(0, cl)<br>
self.canvas.setLayerSet(layers)<br>
<br>
</div>And I got no error message for the Vector layer method any more, but I did the same correction in the same part of the raster layer method and when using it, I'm getting that the argument in<br>
self.canvas.setLayerSet(layers) has an invalid type. Could you please tell me what's wrong? I was thinking I may have to make "layers" a global variable and call it from my raster method to keep inserting in it... but it doesn't have the type I'd need to do so... I'm not quite understanding how this "appending" of layers works... :-|<br>
<br>
I need to upload the vector first because it is the base map, then add the raster, and then I do have to reorganize my layers as you said when I get the layerset ok, thank you.<br>
<br>
Thanks a lot,<br>
<div><div></div><div class="h5">Angelica._______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</div></div></blockquote></div><br>-- <br>-----------<br> |\__ <br>(:>__)(<br> |/ <br><br>Soluciones Geoinformáticas Libres <br><a href="http://geotux.tuxfamily.org/">http://geotux.tuxfamily.org/</a><br>