<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>Hi:<BR><BR>&nbsp;<BR><BR>I´m trying to add and remove layers from a plugin written in python I use this code to&nbsp;remove the layer:<BR><BR>&nbsp;<BR><BR>&nbsp;<BR><BR>layer=self.iface2.activeLayer()<BR>QgsMapLayerRegistry.instance().removeMapLayer(layer.getLayerID());<BR><BR>&nbsp;<BR><BR>those lines remove the layer from mapCanvas but&nbsp;they don't&nbsp; remove the layer from legend.<BR><BR>Is there a method to remove the layer from mapCanvas and mapLegend simultaneosly?<BR><BR>&nbsp;<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>