Combining 2 rasters with Con statement

2846
4
08-25-2016 01:27 PM
CoryGallipeau
New Contributor II

I'm trying to combine 2 rasters together and am trying to do it using a 'Con' statement in Raster Calculator.  I want to use the full extent raster (raster "A") for most of the values but where there is overlap of the two layers, use raster "B" for those values.  So the statement in plain English is "Where raster "B" exists, use those values.  In all other places, use Raster "A".  My syntax isn't correct as I keep getting results that don't reflect my desire.

Tags (2)
0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus

show your syntax and have you explicitely set the extent to be the union of the two rasters. parts thereof, in the Environments tab of the Con tool (don't raster calculator anything that you can do with the tool equivalent).  

You could consider incorporating IsNull into the con like Con(IsNull('B'), 'A', 'B') or similar

CoryGallipeau
New Contributor II

I haven't set the extent at all and when I just ran a RC command that you mention using "Is Null" it makes the cells in raster 'B' be Null and I want them to have their cell values but am getting an error when I replace "Is Null" with raster 'B'.  Here's the syntax of that: Con("nhdperennial"("nhdperennial"),"watsurfinn",wellsnhd)

0 Kudos
DarrenWiens2
MVP Honored Contributor

Con("nhdperennial"("nhdperennial"),"watsurfinn",wellsnhd)

The first argument should be a comparison, not "nhdperennial"("nhdperennial"), and your last argument needs quotes.