Skip to main content

Hi,

I am writing to ask a question about RasterExpressionEvaluator. I have a buffer layer around one point, and I created a raster out of this buffer layer. In this buffer layer, I used red color for distance 0-100 meter, purple for 100-300 meter and blue for 300-400 meter. Now I would like to overlay the buffer on the Geotiff. So, I need the colors to be transparent so the background color of Geotiff can also be visible. I have used RasterExpressionEvaluator with raster buffer as input for port B and Geotif as input for port A. Then I have used this band expression list: if(B[0]==0,A[0],A[0]+B[0]/5);if(B[0]==0,A[0],A[0]+B[0]/5);if(B[0]==0,A[0],A[0]+B[0]/5). However, when I run the work space the color of raster buffer will not as I specified before using RasterExpressionEvaluator.

Any help would be highly appreciated,

Regards, Mitra

Hi @mitra, if you are using FME 2017, RasterMosaicker (Overlapping Values: Composite Using Alpha Band) could be a quick solution. Alternatively, using the MapnikRasterizer could also be a workaround.

[Addition] These screenshots illustrate my intention.

RasterMosaicker (FME 2017.0+): The RasterInterpretationCoercer would not be necessary if the interpretation of the background raster originally was RGBA32.

MapnikRasterizer:

Result:


Hi @mitra, if you are using FME 2017, RasterMosaicker (Overlapping Values: Composite Using Alpha Band) could be a quick solution. Alternatively, using the MapnikRasterizer could also be a workaround.

[Addition] These screenshots illustrate my intention.

RasterMosaicker (FME 2017.0+): The RasterInterpretationCoercer would not be necessary if the interpretation of the background raster originally was RGBA32.

MapnikRasterizer:

Result:

Of course the RasterExpressionEvaluator can also be used. e.g.

 

 

Band Expressions: Set Opacity of Buffer Area to 60%.

 

 

InterpretationExpressionRed8@if(Bi0]+B01]+B12] == 0, A00], @uint8(At0]*0.4 + B 0]*0.6))Green8@if(Bi0]+B01]+B12] == 0, A01], @uint8(At1]*0.4 + B 1]*0.6))Blue8@if(Bi0]+B01]+B12] == 0, A02], @uint8(At2]*0.4 + B 2]*0.6)).Addition] Note that the RasterExpressionEvaluator (Two Rasters mode) requires that the A and B rasters have the same extents and resolution.

Hi @ takashi,

Thank you so much for taking the time to response to my question. I have followed your solution and it works quiet well. However, I still have two questions:

1- how can I increase the transparency of one of the rastered buffer?

As far as I know, if for example one fifth of the rastered buffer pixel values are added to the values of the original pixels of the Geotiff image that are covered by the buffered, then it gives us a semitransparent look.

2- I am afraid that I could not totally understand the Band Expressions equations. It would be highly appreciated if you can give me some explanations about them.

Many thanks in advance,

Mitra

22Thank


Hi @ takashi,

Thank you so much for taking the time to response to my question. I have followed your solution and it works quiet well. However, I still have two questions:

1- how can I increase the transparency of one of the rastered buffer?

As far as I know, if for example one fifth of the rastered buffer pixel values are added to the values of the original pixels of the Geotiff image that are covered by the buffered, then it gives us a semitransparent look.

2- I am afraid that I could not totally understand the Band Expressions equations. It would be highly appreciated if you can give me some explanations about them.

Many thanks in advance,

Mitra

22Thank

You can control transparency with alpha (opacity) value (0: transparent - 1: opeque) of the pixels for the buffer area.

 

  • RasterMozaicker method: Smaller Alpha Value in the ImageRasterizer draws more transparent buffer area.
  • MapnikRasterizer method: Smaller Opacity value in the Polygon Symabolazer parameter setting draws more transparent buffer area.
The expressions in the RasterExpressionEvaluator blend the colors of the background and the buffer area according to a certain ratio. In the example above, the ratio is 0.4 : 0.6 (sum = 1.0), and the result is equivalent to 60% opacity as visual effect. You can control transparency by modifying the ratio.

 

The condition "B;0]+B+1]+B+2]==0" just means all band values are equal to 0, i.e. outside of the buffer area. Equivalent to "B;0]==0 && B 1]==0 && B 2]==0".

Thank you so much


Reply