<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi people,<div><br></div><div>How  in pyqgis can I set filter legend on base map content in layer panel?</div><div><br></div><div>I load a vector data and I would set filter legend and I would ask you some suggestions</div><div><br></div><div>this my code:</div><div><br></div><div><div>groupName="%s " % (self.dat)</div><div>root = QgsProject.instance().layerTreeRoot()</div><div>group = root.addGroup(groupName)</div><div>group.setExpanded(False)  </div><div><div><br></div><div>if settings.SERVER == 'sqlite':</div><div>            sqliteDB_path = os.path.join(os.sep, 'pyarchinit_DB_folder', settings.DATABASE)</div><div>            db_file_path = '{}{}'.format(self.HOME, sqliteDB_path)</div><div><br></div><div>            uri = QgsDataSourceUri()</div><div>            uri.setDatabase(db_file_path)</div></div><div><div>            uri.setDataSource('', 'pyarchinit_us_view', 'the_geom', cont_per_string, "ROWID")</div><div>            layerUS = QgsVectorLayer(uri.uri(), layer_name_label_us, 'spatialite')</div><div><br></div><div>            srs = QgsCoordinateReferenceSystem(self.SRS, QgsCoordinateReferenceSystem.PostgisCrsId)</div><div><br></div><div>            if layerUS.isValid():</div><div>                style_path = '{}{}'.format(self.LAYER_STYLE_PATH_SPATIALITE, 'us_view.qml')</div><div>                layerUS.loadNamedStyle(style_path)</div><div>                group.insertChildNode(-1, QgsLayerTreeLayer(layerUS))</div><div>                QgsProject.instance().addMapLayers([layerUS], False)</div></div><div>  Thanks</div><div>E</div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Enzo Cocca PhD</div><div dir="ltr">in "Science and Technology for Archaeology and Cultural Heritage"</div><div dir="ltr"><br></div><div dir="ltr"><div style="font:400 13.33px/19.99px Arial,Helvetica,sans-serif;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;overflow:visible;text-decoration:none;word-spacing:0px;white-space:normal;background-color:transparent"><div style="font:400 13.33px/19.99px Arial,Helvetica,sans-serif;overflow:visible"><span style="font:400 13.33px/19.99px Arial,Helvetica,sans-serif;overflow:visible">ISMEO</span></div><div style="font:400 13.33px/19.99px Arial,Helvetica,sans-serif;overflow:visible">International Association of Mediterranean and Oriental Studies </div></div><br></div><div dir="ltr"><img width="200" height="75" style="font: 400 13.33px / 19.99px Arial, Helvetica, sans-serif; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: visible; text-decoration: none; word-spacing: 0px; white-space: normal; background-color: transparent;" src="https://docs.google.com/uc?export=download&id=1ho_PBK4C-4cl8Ubqw4oyvusZOhM5P92l&revid=0B2EWPB0itz-iQ3dwZVBaaTVKcEN4VUpwa09scDNRNmNvQkw0PQ"></div><div dir="ltr"><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br><div>mail: <a href="mailto:enzo.ccc@gmail.com" target="_blank">enzo.ccc@gmail.com</a></div><div>cell: +393495087014</div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>