Skip to main content
Solved

setAttribute Python Caller

  • October 22, 2021
  • 2 replies
  • 1200 views

mr_fme
Enthusiast
Forum|alt.badge.img+9

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

david_r
Celebrity
  • 8394 replies
  • 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+9
  • Author
  • Enthusiast
  • 145 replies
  • 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.

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