Skip to main content
Hello,

 

 

I noticed in the Aggregator transformer that there is an option "Attributes to Average, Weighted by Area", is there a way to weight the average by length for a line feature? If not, do you have any recommendations on a different way to get that result?

 

 

Thanks for your help!

 

 

Amanda
Hi Amanda,

 

 

I don't think there is an option to calculate Length weighted average. I would do the following steps.   Before Aggregator: Calculate length of every line feature (LengthCalculator). Calculate (length * attribute value) and set the result to new attribute (ExpressionEvaludator or AttributeCreator). "new attribute value" = "attribute value" * "length"   Aggregator: Calculate sum of the new attribute values and lengths seperately ("Attribute to Sum" parameter).   After Aggregator: Calculate the length weighted average(ExpressionEvaludator or AttributeCreator). "Length Weighted Average" = "sum of new attribute values" / "sum of lengths".   I hope the result will be correct. Wikipedia > Weighted arithmetic mean

 

 

Takashi

Reply