Skip to main content
Solved

Conditional raster band value


Forum|alt.badge.img

I want to redefine raster band values, based on another raster band value.

More specific: If raster band 3 has a value "0", raster bands 0, 1 and 2 should have a value "nodata".

How can this be done most efficiently?

Best answer by lau

Hi Bert,

I have already encountered something similar and fix it with a RasterExpressionEvaluator. I don't remember exactly how I did. You may try:

Red8 --> if(A[3]>0,A[0],-999)

Green8 --> if(A[3]>0,A[1],-999)

Blue8 --> if(A[3]>0,A[2],-999)

After this, add a RasterBandNodataSetter transformer with a Nodata Value = -999

I don't know if it is the most efficient way (and if it works :) )

View original
Did this help you find an answer to your question?

2 replies

lau
Forum|alt.badge.img+3
  • Best Answer
  • August 28, 2018

Hi Bert,

I have already encountered something similar and fix it with a RasterExpressionEvaluator. I don't remember exactly how I did. You may try:

Red8 --> if(A[3]>0,A[0],-999)

Green8 --> if(A[3]>0,A[1],-999)

Blue8 --> if(A[3]>0,A[2],-999)

After this, add a RasterBandNodataSetter transformer with a Nodata Value = -999

I don't know if it is the most efficient way (and if it works :) )


Forum|alt.badge.img
  • Author
  • August 28, 2018
lau wrote:

Hi Bert,

I have already encountered something similar and fix it with a RasterExpressionEvaluator. I don't remember exactly how I did. You may try:

Red8 --> if(A[3]>0,A[0],-999)

Green8 --> if(A[3]>0,A[1],-999)

Blue8 --> if(A[3]>0,A[2],-999)

After this, add a RasterBandNodataSetter transformer with a Nodata Value = -999

I don't know if it is the most efficient way (and if it works :) )

Works with the RasterExpressionEvaluator and RasterBandNodataSetter, thanks!

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings