I want to clone my generated memory layer and apply different filters and symbology. The clone is visible in the layer tree, but doesn't show up in the canvas. What am I doing wrong?
uri = f'point?crs=EPSG:25832&field=id:integer&index=yes'
l_out = QgsVectorLayer(uri, 'new layer', 'memory')
x, y = 369000, 5616000
with edit(l_out):
for i in range(10):
f = QgsFeature(l_out.fields())
g = QgsGeometry(QgsPoint(x, y))
f.setGeometry(g)
f.setAttributes([i])
l_out.addFeature(f)
x += 50
y += 50
project = QgsProject.instance()
project.addMapLayer(l_out)
tree = project.layerTreeRoot()
group0 = tree.insertGroup(0, 'level 0')
group1 = group0.addGroup('level 1')
lcopy = project.addMapLayer(l_out.clone(), False)
nodecopy = group1.insertLayer(-1, lcopy)