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
Best answer by takashi
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
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.
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