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?
RasterToPolygonCoercer assign color to output polygons
Best answer by takashi
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, B). 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.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.


