<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>Hi:<BR><BR> <BR><BR>I´m trying to add and remove layers from a plugin written in python I use this code to remove the layer:<BR><BR> <BR><BR> <BR><BR>layer=self.iface2.activeLayer()<BR>QgsMapLayerRegistry.instance().removeMapLayer(layer.getLayerID());<BR><BR> <BR><BR>those lines remove the layer from mapCanvas but they don't remove the layer from legend.<BR><BR>Is there a method to remove the layer from mapCanvas and mapLegend simultaneosly?<BR><BR> <BR><BR>Best regards<BR><BR>Godofredo Contreras<BR><br /><hr />Hotmail to go? Get your Hotmail, news, sports and much more! <a href='http://mobile.msn.com' target='_new'>Check out the New MSN Mobile</a></body>
</html>