RasterCellCoercer
From fmepedia
RasterCellCoercer is a Workbench Transformer.
| Table of contents |
Summary
NB:In previous incarnations this transformer was known as the RasterPointExtractor, GridPointExtractor and RasterToPointCoercer
The RasterCellCoercer vectorizes raster data by converting each cell into either a point feature or polygon feature.
In point mode it is more suitable for working with DEM data than for aerial photos or other images, as point features can then be used in transformers such as the SurfaceModeller.
In polygon mode it is mostly suitable for thematic mapping, as polygons with similar values can be dissolved together to produce larger areas.

Above: The RasterCellCoercer Settings Dialog.
Modes
- In Point mode one point feature is output for each cell in the raster.
- In Polygon mode one polygon feature - equivalent to the size of a cell - is output for each cell.
Output Attributes
- Each point receives a raster ID and a band ID which correspond to the raster and band from which the point originated.
- If Preserve Attributes is set to Yes, each point will retain the attributes from the input raster.
Nodata
If Extract Nodata Values is set to No, features will not be output for nodata cells in the raster. If set to Yes, then a feature will be output for each nodata cell. The default is No.
Example
The attached workspace shows an example use of the RasterCellCoercer transformer.

Above: RasterCellCoercer Example Workspace.
This example works in polygon mode to extract elevation data from a CDED format DEM. Polygons of equal elevation are merged together with the Dissolver transformer to create data suitable for use in a layer-shading relief map.
The "Overlapping Input" on the Dissolver transformer is set to "Overlap", meaning dissolve overlapping polygons. In theory there shouldn't be any overlaps. In practice I set this just to be sure no hidden problems sneak past and that I'm getting the output I want.
Viewing the Output
In this example there is no writer: the output opens automatically in the FME Viewer to be inspected.

Above: The source raster data (as interpreted by the FME Viewer - remember it's just DEM data).

Above: The output vector data (300x300 resolution).

Above: ...and the same data in closeup. Remember, these are polygons and no longer raster cells.
The Stripes!
You've probably noticed that the data above is a bit stripey - you can see horizontal bands where it should be solid polygons. That was a small fault (a gap of about 0.0000000002 between adjacent polygons) in the beta build I used. It's been fixed in build 5587.
Additional Elements
There are a couple of additional transformers in the workspace that are worth discussing.
Raster Resampling
A common problem with converting raster cells to vector is the sheer scale of the output data; in this case a 1201x1201 raster results in 1,442,401 polygon features. Attempting to dissolve this many features is a severe burden on system resources, and can take some time to complete. The RasterResampler transformer solves this problem by reducing the precision of the source data.
In the workspace the resampling values are prompted for as 'precision' (maybe 'resolution' would have been a better term). A value of 50 would give a 50x50 raster and 1201 would be maximum precision (since the size of the full raster is 1201x1201). It's assumed that x and y sizes are equal; which is true in this case, but not necessarily correct for any data you might use.
The greater the precision the more polygons will be output and the longer the process will take. On my machine:
| Resolution | Number of Cells | Time |
|---|---|---|
| 50 | 2,500 | 30 seconds |
| 100 | 10,000 | 3 minutes |
| 300 | ~100,000 | 19 minutes |
| 1201 (max) | ~1,500,000 | 6 hours 11 minutes |
If the process runs out of memory (that happened to me when I tried it on a dataset with ~2.5m cells) adjust the "max features in memory" setting in a downwards direction and try again. In the attached workspace it is set to zero to ensure the best chance of completion on any system. Obviously in FME2009 you shouldn't need to do that because that setting has been removed in favour of better memory management techniques.

Above: Output data at precision = 50.

Above: Output data at precision = 100.

Above: Output data at precision = 300.

Above: Output data at precision = 1201.
Layer Grouping
Merging polygons together on the basis of their original elevation has the drawback that not many adjacent polygons may have the exact same values. It would be much more logical - and more in line with a layer-shaded map - to group features at 10ft intervals.
The ExpressionEvaluator transformer is how this workspace carries out this task. It simply divides the actual elevation by ten and rounds the value off to an integer. By doing so it effectively creates 10ft bands of elevation across the data.
Data Inspection
FME is not a mapping tool and does not create cartographic output: to view the data in the FME Viewer, as it might look in a map, it's necessary to set a group-by on the Visualizer transformer. This will ensure each elevation band is a different colour.
