Skip to main content
Question

Summing the population data from several rasters for overlapping polygons

  • Apr 16, 2025 7:31 AM UTC
  • 4 replies
  • 183 views

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+67
  • 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
Celebrity
Forum|alt.badge.img+58
  • Celebrity
  • Apr 16, 2025 9:16 AM UTC
  • 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
Celebrity
  • Apr 16, 2025 4:15 PM UTC

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
Celebrity
  • Apr 17, 2025 2:03 AM UTC

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