Skip to main content
Solved

List attribute created in custom transform by a python caller can not be used after the custom transformer

  • September 1, 2022
  • 4 replies
  • 31 views

Forum|alt.badge.img+1

I try to make a custom transformer to do linear referencing of point features to a maximum of 10 polylines. Inputs are point features and polyline features with or without measurements. The custom transformer would output a list with the combination _kp{0}.KP, _kp{0}.DCC, _kp{0}.selectedRoute. The KP is the distance along the polyline, DCC is the perpendicular distance to the polyline (negative values on LEFT side of the polyline, positive on the RIGHT side), and selectedRoute name is the name of each polyline.

At the end of the custom transformer FME shows the list being created for each feature, but it can not be used in the attributemanager following the custom transformer.

screenshot workspace

Best answer by debbiatsafe

Hello @vandijkjoostjan​ 

Any attributes created within a PythonCaller needs to be exposed using the Attributes to Expose parameter within the transformer or an AttributeExposer. This allows the created attributes to be referenced in transformers downstream of the PythonCaller. Were the _kp{}.DCC and _kp{}.KP list attributes exposed?

Expose attributes created in PythonCaller using the Attributes to Expose parameter of transformer

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.

4 replies

debbiatsafe
Safer
Forum|alt.badge.img+21
  • Safer
  • 648 replies
  • Best Answer
  • September 2, 2022

Hello @vandijkjoostjan​ 

Any attributes created within a PythonCaller needs to be exposed using the Attributes to Expose parameter within the transformer or an AttributeExposer. This allows the created attributes to be referenced in transformers downstream of the PythonCaller. Were the _kp{}.DCC and _kp{}.KP list attributes exposed?

Expose attributes created in PythonCaller using the Attributes to Expose parameter of transformer


Forum|alt.badge.img+1

Hello debbiatsafe, You are correct I forgot to expose the attributes in the pythoncaller. This solved my problem. Thank you.


  • 2 replies
  • May 24, 2023

Great transformation utility. It was exactly what I was looking for. However, I am finding one problem. The DCC values are all calculated as positive values whereas the above text indicates "DCC is the perpendicular distance to the polyline (negative values on LEFT side of the polyline, positive on the RIGHT side)". I know that the points I have lie on both sides of the line; i.e. DCC is expected to be both +ve and -ve. I am not sure if somebody here could clarify what I am doing wrong.


  • 2 replies
  • May 25, 2023

Great transformation utility. It was exactly what I was looking for. However, I am finding one problem. The DCC values are all calculated as positive values whereas the above text indicates "DCC is the perpendicular distance to the polyline (negative values on LEFT side of the polyline, positive on the RIGHT side)". I know that the points I have lie on both sides of the line; i.e. DCC is expected to be both +ve and -ve. I am not sure if somebody here could clarify what I am doing wrong.

Ignore my query above; I should have really checked better before posting this query. In fact, the answer was already available in the first post by vandijkjoostjan.

For those who might have a similar problem in the future, the mistake I was making was mapping the calculatedDCC rather than _kp(0).DCC. The latter gives the DCC as -ve values to the left and +ve values to the right.