Skip to main content
Question

Summing the population data from several rasters for overlapping polygons


fme_junior
Contributor
Forum|alt.badge.img

I have two layers: 

  • one raster with population data for each cell (blue)
  • overlapping polygons (buffer of 100m) around existing road segments (red)

I would like to know the total population contains in each polygon. How do I do this in FME?

 

 

 

4 replies

nielsgerrits
VIP
Forum|alt.badge.img+54
  • Make sure the polygons have a unique ID for each polygon. (Counter, PolygonId)
  • Start developing with one polygon. (Sampler, 1 first N features)
  • Clip the raster using the polygon, merge the PolygonId attribute from the polygon to the clipped result. (Clipper).
  • Create polygons from the raster cells. (RasterCellCoercer)
  • Calculate the area of the raster cell polygons. (AreaCalculator, area_original)
  • Clip the raster cell polygons using the polygon, group by PolygonId. (Clipper)
  • Calculate the area of the clipped raster cell polygons. (AreaCalculator, area_clipped)
  • Correct the raster cell values for the clipped area. (AttributeCreator).
  • Dissolve the clipped raster cell polygons, sum the corrected cell values, group by PolygonId. (Dissolver)

Attached sample workspace.

 


danilo_fme
Evangelist
Forum|alt.badge.img+44
  • Evangelist
  • April 16, 2025
nielsgerrits wrote:
  • Make sure the polygons have a unique ID for each polygon. (Counter, PolygonId)
  • Start developing with one polygon. (Sampler, 1 first N features)
  • Clip the raster using the polygon, merge the PolygonId attribute from the polygon to the clipped result. (Clipper).
  • Create polygons from the raster cells. (RasterCellCoercer)
  • Calculate the area of the raster cell polygons. (AreaCalculator, area_original)
  • Clip the raster cell polygons using the polygon, group by PolygonId. (Clipper)
  • Calculate the area of the clipped raster cell polygons. (AreaCalculator, area_clipped)
  • Correct the raster cell values for the clipped area. (AttributeCreator).
  • Dissolve the clipped raster cell polygons, sum the corrected cell values, group by PolygonId. (Dissolver)

Attached sample workspace.

 

Awesome - great solution!


takashi
Influencer
  • April 16, 2025

Hi ​@fme_junior ,

I think the solution depends on how you assume the destribution of population in a cell.
Do you assume population of a cell is uniformly distributed in entire area of the cell, or concentrated at the center point of the cell? 


takashi
Influencer
  • April 17, 2025

More specifically, which one is your preferable population that should be added from the cell to the buffer polygon, in the screenshot? Assuming the cell value (population) is 100.

  • 100, since the cell intersects the buffer
  • 30, since 30% of cell area overlays the buffer * I think this is ​@nielsgerrits’s suggestion.
  • 0, since the center point of the cell is outside the buffer (100, if the center point was inside the buffer)

blue: a raster cell whose value (population) is 100
red: a polygon (buffer of road) instersecting the cell
black: center point of the cell

 


Reply


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