0

I'm trying to compute area-weighted averages of a field when dissolving a feature layer. I thought the solution would be to:

  1. create a new field that is the product of the original field value and the original shape area: new_field = !original_field!*!Shape_Area!
  2. Perform the dissolve on field my_class with the SUM statistic for new_field: SUM_new_field = Sum(new_field)
  3. Divide new_field by the dissolved feature area: aw_field = !SUM_new_field!/!Shape_Area!.

I additionally want to use single-part features only, so I uncheck the "multipart features" option in Dissolve. However, the result is that the values of aw_field is identical for every feature of a given value of my_class. It appears that ArcGIS first dissolves into multi-part features, does the statistics computation on the multi-part features, and then splits the multi-part features into single-part features and simply assigns the multi-part feature value of the statistics field to each resulting single-part feature.

What is the most efficient work-around to get an area-weighted average for dissolved single-part features? I can see a procedure where you first dissolve into single-part features with no statistics, use the resulting layer as an identity feature or for zonal statistics on the original layer, and then join those results back to the dissolved feature... but that seems obnoxious and needlessly computer-intensive. Does anyone have a better idea?

  • Thought it might be a typo, but you need to divide SUM_new_field to Shape_Area at the third step, otherwise you will find the original_field values returned back. If it is a typo and you are doing the right calculation, then try Multipart to single part tool first, then apply your steps. It only adds one more step! – fatih_dur Sep 13 '16 at 6:07
  • Thanks, fixed the typo! I had it right in my code though :) Not sure what you're suggesting with the multi-part to single part tool---Could you elaborate or post an answer? Dissolve can convert to single-part automatically, but the issue is that it first creates multi-part features and does the statistics on those, and then converts to single part---so the area-weighting doesn't work properly. – mikeck Sep 13 '16 at 17:50
  • Please disregard my previous comment, I understood your question differently. I think your solution is the way. Even though it is one layer, you are using two aggregations to get area weighted average. My only comment is that, you should be able to replace Identity part with Intersect or Union (depending on the matching coverage and how busy your feature class fields) by using FID_firstdiss again. – fatih_dur Sep 16 '16 at 3:43
2

My current solution:

  1. Create a dissolve layer on my_class to create a layer "firstdiss" of single-part features without any statistics.
  2. Use "firstdiss" as an identity feature for the original layer with "ONLY_FID" option. This creates a new layer "identity" which is basically the original layer with an extra field FID_firstdiss.
  3. create a new field in "identity" that is the product of the field of interest and the shape area: new_field = !original_field!*!Shape_Area!.
  4. Dissolve "identity" by FID_firstdiss, the SUM statistic for new_field, and the FIRST statistic for my_class. This way, you create a new layer "finaldiss" where there is no difference in output were you to dissolve single part or multi-part features.
  5. Divide new_field in "finaldiss" by the dissolved feature area: aw_field = !new_field!/!Shape_Area!.

It works but it requires calling Dissolve twice as well as a call to Identity---not very efficient.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.