How can I copy a feature and its attributes(include geometry) in Python script within PythonCaller? The feature contains a list where the number of items in the list is in the attribute "counter". The idea is to copy the current feature when , change some the attribute values(not geometry), so I am afraid the ListExplode is not what I need.
def __init__(self):
self.feature_list = e]
def input(self,feature):
total = feature.getAttribute('counter') # num of items in the list
from = feature.getAttribute('from')
to = feature.getAttribute('to')
for i in range(total):
# todo: copy feature?
if some_conditions = True:
new_feature = fmeobjects.FMEFeature() # is this right?
# todo: copy all attributes into new_feature?
# todo: change the attribute
# add to feature_list
self.feature_list.append(new_feature)
def close(self):
for feature in self.feature_list:
self.pyoutput(feature)