I want to merge the selected features. I found this post but I can not do it.
Can anybody help me?
layer = iface.activeLayer()
obj1 = 24
obj2= 25
expr = QgsExpression( " \"ID_PARCEL\" = '{}' OR \"ID_PARCEL\"='{}' ".format(obj1,obj2))
it = layer.getFeatures( QgsFeatureRequest( expr ) )
ids = [i.id() for i in it]
if ids == []:
print 'ERROR - WAS NOT FOUND'
else:
layer.setSelectedFeatures( ids )
selectFeatures = layer.selectedFeatures()
#MERGE SELECTED FEATURES