Skip to main content
Solved

How to keep attributes in custom transformer locally

  • June 25, 2016
  • 1 reply
  • 26 views

Forum|alt.badge.img+7

Hi all,

 

I am working a lot with custom transformers lately and I noticed that if an attribute is created inside the custom transformer, it overwrites the value of this attribute if the feature entering the custom transformer already has an attribute with the same name.

 

I was wondering if / how it is possible to keep the attributes created in the custom transformer local so that they don't overwrite the already existing attributes (not exposing the attribute in the output port doesn't work since then the initial attribute also will be unexposed.

 

I am asking for this behaviour since I want to be sure that my custom transformers - that are used by multiple people - don't mess with the attributes unexpectedly.

I figured that I could be using a custom prefix for attributes created in the custom transformers but this isn't the cleanest solution in my opinion.

Thanks for you help!

Jeroen

FYI: The related 'idea'

Best answer by takashi

I think that special prefix addition is a general way to avoid conflict between input attributes and local attributes which will be consumed internally, although it may not be clean. Recently I'm using "double underscores + string specific to the custom transformer + dot" as prefix. e.g. "__mytransformer.<attribute name>".

This may be ugly, but convenient to identify/select local attributes in the tree view for some transformer parameters or rename/remove them at once with the BulkAttributeRenamer/Remover.

Other than that, there are some cases where the FeatureMerger can be used to merge original attributes and transformed geometry. For what it's worth...

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

1 reply

takashi
Influencer
  • Best Answer
  • June 25, 2016

I think that special prefix addition is a general way to avoid conflict between input attributes and local attributes which will be consumed internally, although it may not be clean. Recently I'm using "double underscores + string specific to the custom transformer + dot" as prefix. e.g. "__mytransformer.<attribute name>".

This may be ugly, but convenient to identify/select local attributes in the tree view for some transformer parameters or rename/remove them at once with the BulkAttributeRenamer/Remover.

Other than that, there are some cases where the FeatureMerger can be used to merge original attributes and transformed geometry. For what it's worth...


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