I tried running the Class Interface example on this page:
But the code as written, (after correcting the indentation) gives me the same area for each polygon.
To get the expected result I have to remove the 3rd & 4th from last lines (and re-correct the indents) i.e.:
import fmeobjects
class FeatureProcessor(object):
def __init__(self):
self.featureList = _]
self.totalArea = 0.0
def input(self,feature):
self.featureList.append(feature)
self.totalArea += feature.getGeometry().getArea()
feature.setAttribute("total_area", self.totalArea)
self.pyoutput(feature)
Was this written for an earlier version of Python, or is it an error? I'm not good enough at Python to know why the original script didn't work.