I have a geotiff image feeding a rasterToPolygonCoercer. I need to assign the value of the output polygons based on the input raster palette and value. How do I feed the MapInfo TAB writer the correct color from the RasterToPolygoneCoercer?
Hi @jayrussell
I think my answer to this post: https://knowledge.safe.com/questions/78473/convert-raster-to-vector-grid-populate-attributes.html?childToView=78480#answer-78480 is what you are after.
H @jayrussell, if the raster has a palette to define colors, at first you will have to resolve the palette to transform the raster from the single band (palette entry) to 3 bands (color elements: R, G, . You can use the RasterPaletteResolover here.
The RasterToPolygonCoercer adds an attribute called "_label" to the output polygons, which stores comma separated cell values. In the case where the raster interpretation was RGB24 (3 bands = Red8, Green8, Blue8), each cell value is in the range 0-255.
FME requires comma separated color values normalized in the range 0-1 for setting a color to features, so you also will have to add a process to normalize the color value.
This is an example, assuming that the palette defines RGB24 color.
Hope this helps.
H @jayrussell, if the raster has a palette to define colors, at first you will have to resolve the palette to transform the raster from the single band (palette entry) to 3 bands (color elements: R, G, . You can use the RasterPaletteResolover here.
The RasterToPolygonCoercer adds an attribute called "_label" to the output polygons, which stores comma separated cell values. In the case where the raster interpretation was RGB24 (3 bands = Red8, Green8, Blue8), each cell value is in the range 0-255.
FME requires comma separated color values normalized in the range 0-1 for setting a color to features, so you also will have to add a process to normalize the color value.
This is an example, assuming that the palette defines RGB24 color.
Hope this helps.
Is there a way to retain the original palette index that was present before the RasterPaletteResolver? It represents a radar reflectivity dB that I need to retain along with assigning a color.
H @jayrussell, if the raster has a palette to define colors, at first you will have to resolve the palette to transform the raster from the single band (palette entry) to 3 bands (color elements: R, G, . You can use the RasterPaletteResolover here.
The RasterToPolygonCoercer adds an attribute called "_label" to the output polygons, which stores comma separated cell values. In the case where the raster interpretation was RGB24 (3 bands = Red8, Green8, Blue8), each cell value is in the range 0-255.
FME requires comma separated color values normalized in the range 0-1 for setting a color to features, so you also will have to add a process to normalize the color value.
This is an example, assuming that the palette defines RGB24 color.
Hope this helps.





The order of bands (palette index -> color, or color -> palette index) can be controlled by setting the Connection Runtime Order at the output port (right-click > Set Connection Runtime order) where the data flow branches into two streams. e.g. at the Junction in the screenshot below.