Skip to main content

Attached is a testkit with a raster (geotiff 10mx10m), 3 overlayered polygons and workspace.

I would expect that if I clip the given raster with the smaller polygon the raster sum would be smaller. Clipping with a larger polygon (which contains the smaller polygon) would yield a larger rastersum.

The polygon named T20 in contained within T100 - but the rastersum is larger for T20 than for T100 - if the cellsize is 7 or 10m.

The last transformer calculates the ratio on the rastersums between the different clips, and there doesn't seem to be any pattern.

 

 

@mathiku​ Raster clipping is based on the center point of the raster cell. Your cell spacing is 10x10 but the clip areas only differ by 5m or less. So they are likely picking up many of the same pixels in the clip. If you want a more exact clip of the raster then try the RasterToPolygonCoercer first, and then clip.


Thanks for your reply.

That part I understand, what I don't understand is that the smaller polygon (T20 - which fits inside T100) can return a larger rastersum than the larger polygon. That result must mean the T20 is touching cell-centerpoints that T100 isn't touching, which can't be true.


@mathiku​ try resampling your raster to a smaller pixel size that matches the scale of you areas. there does seem to be an issue with the way the FME decides whether to include a pixel in the clip. I have learnt that the way FME clips a raster is to build a mask on the raster that represents the clipper.


@Mark Stoakes​ I understand the workarounds - but I can't help getting really concerned for all my previous analysis. Just getting the resampling factor/cell-size right is tedious - for this example I would have to resample the raster to fit the shortest straight line in the vector layer, which is only a few centimeters.

@Takashi Iijima​ - I hope it's okay I tag you, I think this is potentially quite problematic and your answers are usually high quality.


@Mark Stoakes​ I understand the workarounds - but I can't help getting really concerned for all my previous analysis. Just getting the resampling factor/cell-size right is tedious - for this example I would have to resample the raster to fit the shortest straight line in the vector layer, which is only a few centimeters.

@Takashi Iijima​ - I hope it's okay I tag you, I think this is potentially quite problematic and your answers are usually high quality.

We are taking a closer look at this. There does seem to be a problem with the way that Clipper is building the clip mask. Tracked as issue FMEENGINE-68888


@mathiku​ We have changed the Clipper to be more consistent when clipping raster datasets. FME now uses a more consistent approach to clipping based on the centre of the pixel. This is available in FME 2022 betas.


Reply