I use Qgis. I have two layers that are two circles with the same center. One larger and one smaller. I want to do the difference between the two circles BUT only if they have the same "objectid" (the same id). So I have written this code:
for features in itertools.product(elayer.getFeatures("objectid"), player.getFeatures("objectid")):
id = tuple(feat.attributes()[0] for feat in features)
print("elayer" ,id[0] , "player", id[1])
if id[0] == id[1]:
pass
processing.runAndLoadResults("native:difference",
{'INPUT':elayer(id[0]), 'OVERLAY': player(id[1]), 'OUTPUT':'memory:'})
where elayer and player are clearly the two layers. But this code makes me all differences between all geometries in the two layers. How can I adjust it in order to get what I want?