Solved

Finding the sum of an attribute of all features inside a polygon

  • 4 December 2017
  • 8 replies
  • 84 views

Badge

Hi there,

I have a bunch of small polygons that each have an AREA attribute, showing their square footage. These are contained within several much larger polygons.

What I need is if Large polygon A contains 3 small polygons, one 100ft, one 50ft, and one 75ft, I want to generate a new attribute in my output that says Large polygon A contains 225ft. The same happens for Large Polygon B, C, so on. My output is essentially the Large polygon layer, but with the additional new attribute.

I did try a spatial relator between the small and large polygons, and then a Statistics Calculator outputting SUM and grouping by the unique ID each Large polygon has, but it seems like the output attribute is the first small polygon contained, not all of them together.

Any insight in what I can do different here to get the correct results?

icon

Best answer by redgeographics 4 December 2017, 14:51

View original

8 replies

Userlevel 4
Badge +30

Hi @robbie_botha,

Have you tried to use the transformer AreaOnAreaOverlayer?

Enable the option Generate List to get the attributes all polygons inside.

Thanks,

Danilo

Badge

Hi @danilo_inovacao,

I'm not quite sure how this would work, seeing as that transformer only has one input port, and I need to be sure that my output is only the large polygons. I might not have been clear about it, but the large and small polygons are two separate layers, and my output can only contain the large ones.

Userlevel 2
Badge +17

Hi @robbie_botha, if you check the Generate List option in the SpatialRelator, the values of "AREA" from spatially related small polygons will be stored in a list attribute. You can then sum the values with the ListSummer transformer.

Userlevel 5
Badge +25

I've taken a different approach:

area-summing.fmwt

First a SpatialRelator to see within which large polygon (the neighborhoods in this case) each smaller one (parks*) is. Then a StatisticsCalculator to calculate the sum of all park areas per neighborhood and a FeatureMerger to merge that information back to the original neighborhoods.

* Yes, I know the parks have a NeighborhoodName attribute, so for the sake of the example I've removed that.

Userlevel 3
Badge +26

The Dissolver transformer may be of use to you. If your large polygons are separated you shouldn't need a group by option. If they are, hopefully you have an attribute that you can group by. The Dissolver has an 'Attributes to Sum' option.

Badge

I've taken a different approach:

area-summing.fmwt

First a SpatialRelator to see within which large polygon (the neighborhoods in this case) each smaller one (parks*) is. Then a StatisticsCalculator to calculate the sum of all park areas per neighborhood and a FeatureMerger to merge that information back to the original neighborhoods.

* Yes, I know the parks have a NeighborhoodName attribute, so for the sake of the example I've removed that.

Hi @redgeographics,

 

 

I'm a little bad with lists, so your approach appealed to me, and I'm happy to say it worked like a charm.

 

 

Thanks a ton!
Userlevel 5
Badge +25
Hi @redgeographics,

 

 

I'm a little bad with lists, so your approach appealed to me, and I'm happy to say it worked like a charm.

 

 

Thanks a ton!
You're welcome!

 

 

Userlevel 2
Badge +17

Hi @robbie_botha, if you check the Generate List option in the SpatialRelator, the values of "AREA" from spatially related small polygons will be stored in a list attribute. You can then sum the values with the ListSummer transformer.

This screenshot illustrates my intention. FYI

 

 

Reply