Question

PythonCaller - variable as buffer

  • 3 May 2023
  • 1 reply
  • 6 views

Badge

I would like to implement a variable as a buffer. However, once I define the variable, it does not get updated.

 

For example:

The variable has to act like a buffer.. At the moment, I have the variable implemented in the def but I think this is wrong.

 

def buffer(feature):

   puffer = 'leer'

 

for i in range(0,50):   

if puffer == 'leer':

feature.setAttribute('value', value2)

puffer = 'value2'

else:

feature.setAttribute('value', value3)

 

For this example, I get always the Result from feature.setAttribute('value', value2).

 

I have also tried to create a class withdef __init__(self) and Input and close.

But I don't get a Result.The result should be written in the attribute table of a shapefile

 

Can anyone help me?


1 reply

Userlevel 4

You'll have to write your code according to the expectations of FME. Otherwise your code might not be called by FME at all.

See https://community.safe.com/s/article/pythoncaller-transformer

PS: next time, please post your code using the Code Snippet formatting tool, so that indentations are preserved.

 

Reply