Spatial Analyst Question

2857
3
Jump to solution
07-15-2015 05:20 PM
ErikFernandez
New Contributor III

I have two grid files. Grid A has a range of pixel values, Grid B has a value of 0 or 1. I want to create a new grid that shows the the full range of values from Grid A but only where they overlap with Grid B.  Suggestions much appreciated. Hopefully this isn't too complicated a question.

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

​The conditional toolset comes to mind, Con in particular Conditional evaluation with Con—Help | ArcGIS for Desktop  and Con—Help | ArcGIS for Desktop  but since you have a binary grid... why not multiply the grids using Times Times—Help | ArcGIS for Desktop

Except it is not clear if this is what you want....do you want

  • the areas where grid2==1 that overlaps with grid1 to be returned?
  • or grid2 == 0 and grid2 ==1 that overlaps with grid1 to be returned?
  • are there nodata areas in one or both grids?  what to do then?

Con can return multiple condition testings depending what the 'overlap' conditions are in grid 1.

ie

Con("Grid1", "Grid1",0 (or whatever))

        true condition, what to do if true, what to do if false

or

Con("Grid2 == 1, "Grid1", whatever)

etcetera

So have a think about what you want and how to deal with nodata values if present...not to mention, considerations of cell size, raster extent and whether the raster cells are aligned (aka snap raster) all of which can be accessed in the Environments tab of any tool in arctoolbox

View solution in original post

3 Replies
DanPatterson_Retired
MVP Emeritus

​The conditional toolset comes to mind, Con in particular Conditional evaluation with Con—Help | ArcGIS for Desktop  and Con—Help | ArcGIS for Desktop  but since you have a binary grid... why not multiply the grids using Times Times—Help | ArcGIS for Desktop

Except it is not clear if this is what you want....do you want

  • the areas where grid2==1 that overlaps with grid1 to be returned?
  • or grid2 == 0 and grid2 ==1 that overlaps with grid1 to be returned?
  • are there nodata areas in one or both grids?  what to do then?

Con can return multiple condition testings depending what the 'overlap' conditions are in grid 1.

ie

Con("Grid1", "Grid1",0 (or whatever))

        true condition, what to do if true, what to do if false

or

Con("Grid2 == 1, "Grid1", whatever)

etcetera

So have a think about what you want and how to deal with nodata values if present...not to mention, considerations of cell size, raster extent and whether the raster cells are aligned (aka snap raster) all of which can be accessed in the Environments tab of any tool in arctoolbox

ErikFernandez
New Contributor III

Dan - You've bailed me out on two questions in one day... pure awesome. Thank you. I used the "times" function and it worked perfectly for what I was aiming for.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Glad it worked.  Just remember, the problem will dictate the tool to use, but you will soon find out that there is often more ways to do the same thing or get the same result but with more or less information returned.

0 Kudos