I am writing a plugin for QGIS 3.8
I have two layers,
- drop_layer and
- Fibre Cable.
I want to copy all features from the drop_layer and append to Fibre cable layer.
I use a function to create drop_layer using some processing tools. Then iI use following function "merge_to_original_Fibre_layer"merge_to_original_Fibre_layer
to copy all features of this "drop_layer" to another existing layer "Fibre cable". All these functions are part of the main class.
def merge_to_original_Fibre_layer(self):
dlayer = self.drop_layer.getFeatures()
layerObject = QgsProject.instance().mapLayersByName("Fibre Cable")[0]
features = []
for f in dlayer:
features.append(f)
layerObject.startEditing()
layerObject.addFeatures(features)
layerObject.commitChanges()
When iI run the code, all the features of "drop_layer" are getting copied to "Fibre Cable" layer. I see this when I open the attribute table of the layer "Fibre Cable". Even iI am able to zoom map to these features.
The problem is i can not see the geometry of these newly added features on the map. What I am doing wrong? The problem is I cannot see the geometry of these newly added features on the map. What I am doing wrong?