Skip to main content
Solved

Conditional raster band value

  • Aug 28, 2018 9:39 AM UTC
  • 2 replies
  • 90 views

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
This post is closed to further activity.
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.

2 replies

lau
Forum|alt.badge.img+3
  • Best Answer
  • Aug 28, 2018 1:01 PM UTC

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
  • Aug 28, 2018 2:49 PM UTC

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!