Skip to main content

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'

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...


Reply