I need to change the position of a box only if it has a common attribute with a point. In my example if the feature "ID_PARENT"
is the same as "CODE"
.
box = QgsProject.instance().mapLayersByName('box')[0]
point = QgsProject.instance().mapLayersByName('point')[0]
for bfeat in box.getFeatures():
for pfeat in point.getFeatures():
if bfeat['ID_PARENT'] == pfeat['CODE']:
pfeat.geometry() = bfeat.geometry()
Here this code is totally false because I'm assigning a value to a function call but I think it illustrates well what I tried to do which is changing the WKT coordinate.