3

I have a raster of roads saved from a WMS, this a multiband raster. Its red(main) an grey(back) roads.

When using the raster calculator I can select most of the red road by using: Band@1 > 200

But what expression is to be used to select the grey road?

At all grey colours, the 3 bands have the same value. My guess was that this would work, but it did not: Band@1 = Band@2 = Band@3.

I have tried a couple of other variants, but no success.

1

Using a sample of RGB raster of 4 cells:

  • Upper left cell: Light grey (150, 150, 150)
  • Lower left cell: Dark grey (100, 100, 100)
  • Upper right cell: Red (250, 0, 0)
  • Lower right cell: Blue (0, 0, 250)

enter image description here

Equation to the Raster calculator to create the filter:

( "Band@1" - "Band@2" = 0) * ( "Band@2" - "Band@3" = 0 ) = 1

(This also works without = 1 .)

The filter returns 1 for R,G,B band (or @1, @2, @3 as in Raster calculator) have the same value.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.