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.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.