Skip to main content
Solved

setAttribute Python Caller

  • October 22, 2021
  • 2 replies
  • 934 views

mr_fme
Enthusiast
Forum|alt.badge.img+8

Hi,

I have a script that does an area calculation using arcpy, the two calculated areas are output in the log, I need each one of them to be output as an attribute, how to do this? I'm new to python at FME.

 

image 

log:

 

imageThe output, it doesn't help me at all.

 

image 

Thank you for your help

 

 

Best answer by david_r

Any particular reason for using arcpy rather than the AreaCalculator transformer?

Other than that, you can add the following on line 124:

feature.setAttribute('total_xyz', total_xyz)
feature.setAttribute('total_TAL', total_TAL)

I've substituted the red "blob" for xyz above. You'll need to also expose the new attributes in the PythonCaller settings.

View original
Did this help you find an answer to your question?

2 replies

david_r
Evangelist
  • Best Answer
  • October 25, 2021

Any particular reason for using arcpy rather than the AreaCalculator transformer?

Other than that, you can add the following on line 124:

feature.setAttribute('total_xyz', total_xyz)
feature.setAttribute('total_TAL', total_TAL)

I've substituted the red "blob" for xyz above. You'll need to also expose the new attributes in the PythonCaller settings.


mr_fme
Enthusiast
Forum|alt.badge.img+8
  • Author
  • Enthusiast
  • October 25, 2021
david_r wrote:

Any particular reason for using arcpy rather than the AreaCalculator transformer?

Other than that, you can add the following on line 124:

feature.setAttribute('total_xyz', total_xyz)
feature.setAttribute('total_TAL', total_TAL)

I've substituted the red "blob" for xyz above. You'll need to also expose the new attributes in the PythonCaller settings.

Hi @david_r​ 

 

Helped a lot. Thank´s 

 

This script is huge, I don't want to change its structure but, I would prefer to use the Area Calculator.

 

Thank´s

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings