When I run a script to calculate an area with PyQGIS
I don't get the same result as when I calculate it with the Expression Builder
.
Here is my script:
myLayer.startEditing()
myIndex = myLayer.fields().indexFromName("pyqgis")
for feature in myLayer.getFeatures():
myLayer.changeAttributeValue(feature.id(), myIndex, round(feature.geometry().area()/10000, 4))
myLayer.commitChanges()
Here is my expression :
$area /10000
Both fields are in the same type and have the same precision
But result isn't the same.
I'm uing QGIS 3.10.2 (LTR)