Solved

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

  • 1 September 2022
  • 4 replies
  • 5 views

Badge +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

icon

Best answer by debbiatsafe 2 September 2022, 03:18

View original

4 replies

Userlevel 3
Badge +17

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

Badge +1

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

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.

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.

Reply