# Raster calculator gives black map output when excluding values

I'm trying to generate an exclusion map from 7 layers of raster having values of zero and one. The zeroes represent the unsuitable area while the ones represent the suitable area. with this, I'm looking to create an exclusion map.

The expression I used in the raster calculator either gives a black map output with zeros as the value, or I just get a blank output.

How can I make this work?

I can use any other expression if there are alternatives. See below the two types of expression I already tried.

``````Con(("Rail_10" == 1) & ("road3" == 1) & ("airport" == 1) & ("powerlines" == 1) & ("Water" == 1) & ("protected" == 1) & ("Urbanfinal" == 1), 0)

("Rail_10" == 1) & ("road3" == 1) & ("airport" == 1) & ("powerlines" == 1) & ("Water" == 1) & ("protected" == 1) & ("Urbanfinal" == 1)
``````

• You need to backtrack into the theory of Boolean logic -- the only way you'd get any result is if a pixel was rail AND road AND airport AND powerline AND water AND protected AND urban. Commented Aug 21, 2023 at 20:27
• Please always present code/expressions as formatted text rather than only in pictures.
– PolyGeo
Commented Aug 21, 2023 at 20:33
• Thanks.. If I understood right, I would never get the desired result using this sort of expression right? Like, a pixel won't likely be in all of the seven layers at a time? I will look into Boolean logic more also Commented Aug 21, 2023 at 21:11
• Just to add, each of the 7 layers has 1 as the suitable area, and zero as non suitable. So I'm expecting pixels across all 7 layers that have 1 as the value...I believe there ought to be a result, no? I followed a tutorial online and the exclusion map was obtained this way.. I just don't understand where I've gone wrong. Commented Aug 21, 2023 at 21:16
• Do you want to select pixels that have all 1's in the rasters (no unsuitable 0 values at all) or pixels that have any 1's (at least one suitable 1 and can have unsuitable 0's)? Commented Aug 22, 2023 at 4:08

## 1 Answer

Your `Con` is outputting only 0's because that's what you specified as the output value. The syntax is:

``````Con(your_expression, value_if_true, optional value_if_false default=NoData)
``````

And you used `Con(your_expression, 0)` so the output would only be zeros and NoData.

But you don't need to use `Con`, you already have boolean rasters (0's and 1's).

Selecting pixels that have all 1's in the rasters (no unsuitable 0 values at all) using Boolean And `&`:

``````"ras1" & "ras2" & "ras3" &  "ras4" & "ras5" & "ras6" & "ras7"
``````

Selecting pixels that have any 1's (at least one suitable 1 and can have unsuitable 0's) using Boolean Or `|`:

``````"ras1" | "ras2" | "ras3" |  "ras4" | "ras5" | "ras6" | "ras7"
``````

This assumes that all pixels in the area of interest are 0 or 1, not NoData.

• Thank you. The expression "ras1" & "ras2".... & "ras7" you suggested gave the result I intended to have. I appreciate the help :) Commented Aug 23, 2023 at 22:04