I have an FME workspace which has a number of different workspaceRunner transformers. The first workspaceRunner launches a workspace which buffers a pipeline and outputs the bounding coordinates to a CSV file.
I then have a python caller which reads the CSV to get the bounding coordinates and save them as global variables.
The code of the Python Script looks like this:
import fmeobjects
import csv
# Template Function interface:
def processFeature(feature):
global XMIN
global XMAX
global YMIN
global YMAX
outputDirectory = FME_MacroValues['Output_Directory']
csvPath = outputDirectory + '\\Buffer Bounds.csv'
coordlist = []
with open(csvPath, 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter = ',')
for row in reader:
coordlist.append(row)
XMIN = float(coordlist[0][0])
XMAX = float(coordlist[0][2])
YMIN = float(coordlist[0][3])
YMAX = float(coordlist[0][4])
print XMIN, XMAX, YMIN, YMAX
pass
# Template Class Interface:
class FeatureProcessor(object):
def __init__(self):
pass
def input(self,feature):
self.pyoutput(feature)
def close(self):
pass
After the PythonCaller, I have four VariableRetriever transformers which get the values of XMIN, XMAX, YMIN, YMAX and save them as attributes.
That is then connected to a workspaceRunner transformer. The parameters for the bounding box are passed to the next workspace and are used to define the Search Envelope Coordinates for the File Geodatabase.
My problem is that these variables are somehow not getting passed to the attributes. Am I using the variableRetriever transformers correctly? I have read on some FME forums that you can use them this way. I've declared them as global variables.