Skip to main content
Solved

Aggregator: Attributes to Average, Weighted by Length?

  • November 12, 2013
  • 1 reply
  • 95 views

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

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
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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.

1 reply

takashi
Contributor
Forum|alt.badge.img+21
  • Contributor
  • Best Answer
  • November 13, 2013
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

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