Conditional statements Raster Calculator

396
6
Jump to solution
09-16-2020 02:00 AM
New Contributor II

Hi,

I am working on a weighted analysis with four rasters. Two of the rasters have areas of NoData, which means I do not want to use the Weighted Overlay tool because this tool does not ignore NoData in calculations. If I were to use the Weighted Overlay tool I would have to assign a value to areas of NoData - and my conclusion is that this would not make the weight calculations completely correct. Someone please correct me if I am wrong!

To get around this problem I started looking into using conditional statements using Con in Raster Calculator. I found a post where someone came up with this syntax:

Con(IsNull(Raster3), Float(w1*Raster1 + w2*Raster2)/(w1+w2) , Float(Raster1 + Raster2 + Raster3)/3)‍‍‍

Where wx is the weighting applied to each raster.

So this works fine with three rasters, where one of the rasters contains areas of NoData.

But what is the syntax if you have two rasters that contains areas of NoData?

Additional questions:
- Is the division necessary in the calculations because not all three rasters are included? And why is the second Float divided by the number 3 and not 1 (as in 100%)?

- In the syntax above, in the second Float the rasters are not multiplied with weightings - is this correct? And if so, please explain why.

Hoping for help!!

Reply
0 Kudos
1 Solution

Accepted Solutions
Regular Contributor

Before you run your process, take Raster3 and convert all the NoData areas to be "0" values.

Then, your weighted overlay should give you the output you are looking for.

This really gets to the heart of the difference between NoData and 0 values.  NoData essentially means "I don't know what is here", so there is no way to quantify the output of the weighted overlay operation.  On the other hand, a 0 value means "this cell has no affect on the operation" (at least for the additive sort of overlay you show above) and can be meaningfully used in a weighted overly.

Jay

Jay
Washoe County GIS

View solution in original post

6 Replies
MVP Frequent Contributor

from .... How Weighted Overlay works—ArcGIS Pro | Documentation 

in the section

Using Restricted and NoData for the scale value

I don't see any reference to nodata making things incorrect.  

What in that explanation do you think would give rise to invalide results?

There are just cautions.


... sort of retired...
Reply
0 Kudos
New Contributor II

Hi Dan, thanks for the response.

I do not mean that NoData makes the calculation incorrect, I mean that classifying NoData to a value makes the results inaccurate and in turn incorrect. I explain all of it below:

If you are running the Weighted Overlay tool with three rasters and one of the raster have cells of NoData, this results in a raster where the NoData areas in one of the rasters "propagates" into the resulting raster (see figure below). This results in kind of a "Intersect" operation of the rasters, which I do not want. 

So to avoid this "Intersection", you have to classify NoData to a value - let's say the value 10. In the Weighted Overlay calculation, this means that these areas (now with the value 10) are a part of the calculation and are effectively made relevant with a weighting, when they are originally not relevant. In my head it would cause incorrect and inaccurate results if you classify NoData values to a number value (value of 10 used as example) and run the Weighted Overlay tool.

Hope this explained better.

So is my thought process about this totally wrong?


This post also explains the issue: arcgis desktop - Weighted Overlay with "nodata" cells - Geographic Information Systems Stack Exchang... 

Reply
0 Kudos
MVP Esteemed Contributor

I do not understand what you want to do with the non-intersecting areas - the reason NoData exists is to mark areas of missing data so you do not have a nonsensical weighted overlay results.  Map Algebra is very flexible but of you want an output cell value of some kind you need to assign it some value. If you want them all just set to zero the simplest thing is to just do the weighted overlay, get the result with the NoData, and convert all NoData to a 'missing value' of your choice:

fixed = Con(IsNull(result_raster), 0, result_raster)
Reply
0 Kudos
Regular Contributor

Before you run your process, take Raster3 and convert all the NoData areas to be "0" values.

Then, your weighted overlay should give you the output you are looking for.

This really gets to the heart of the difference between NoData and 0 values.  NoData essentially means "I don't know what is here", so there is no way to quantify the output of the weighted overlay operation.  On the other hand, a 0 value means "this cell has no affect on the operation" (at least for the additive sort of overlay you show above) and can be meaningfully used in a weighted overly.

Jay

Jay
Washoe County GIS

View solution in original post

New Contributor II

Thank you Jay, your reply got me into the right mindset. I also discovered the Cell Statistics tool which have a "Ignore NoData" parameter which was the best solution for me. I set the calculation parameter to "Sum".

Reply
0 Kudos
Regular Contributor

Great!  Nice solve with Cell Statistics.  

Jay
Washoe County GIS
Reply
0 Kudos