# Connecting information from 2 rasters to 1 raster.

285
2
05-03-2013 04:48 AM
Highlighted
by Anonymous User
Not applicable
Original User: lukasz_tom

Hi,
I'm looking for my problem's solution.
I've got 2 rasters:
one - with classification's output (*.tif - multiple value: 0-9):
[ATTACH=CONFIG]23989[/ATTACH]
and one - with classification of water's output (*.tif - value: 0-1):
[ATTACH=CONFIG]23990[/ATTACH]

I try to insert information from second raster to first raster. I mean:
if in pixel on first raster is NoData value and on second raster value in this the same pixel = 1, then value on output raster = 9 (Water ID), but if not - value from first raster in this pixel.
Eventually i want to obtain this result in on image:
[ATTACH=CONFIG]23991[/ATTACH]

Another step, which I want to obtain is fill all remaining NoData pixels value = 2 (Ground ID).
Does anyone know how solves this problem? I try to use Raster Calculator, but in my way it's not works.
I would appreciate. 😉
Tags (4)
2 Replies
Highlighted
by Anonymous User
Not applicable
Original User: helyxsisltd

I can't promise it's the most efficient method, but you could set up a model that effectively does the following:

With your water raster, use the Set Null tool in the Conditional toolset to set the value zero (not water) to null. Then use the Times tool in the Math Toolset to multiply by 9 (so giving "Raster W" where water = 9 and other = NoData)

With your class raster ("Raster C"), apply these tools from the Math Toolset in the following order:
IsNull, Boolean Not, Plus 1 (so giving "Raster P" where cells have a value 1 where "Raster C" held NoData and 2 where the "Raster C" held a value)

Now use Pick in the Conditional toolset as follows:
Pick("Raster P", "Raster W", "Raster C")

The Pick tool will choose from Raster W wherever Raster C is NoData or from Raster C wherever it holds a value already.

Convoluted, I know. Maybe there's a much simpler way...?
Highlighted
Frequent Contributor II
Go to the symbology tab for your raster.  there should be check boxes on how to display cells with no data.

Hi,
I'm looking for my problem's solution.
I've got 2 rasters:
one - with classification's output (*.tif - multiple value: 0-9):
[ATTACH=CONFIG]23989[/ATTACH]
and one - with classification of water's output (*.tif - value: 0-1):
[ATTACH=CONFIG]23990[/ATTACH]

I try to insert information from second raster to first raster. I mean:
if in pixel on first raster is NoData value and on second raster value in this the same pixel = 1, then value on output raster = 9 (Water ID), but if not - value from first raster in this pixel.
Eventually i want to obtain this result in on image:
[ATTACH=CONFIG]23991[/ATTACH]

Another step, which I want to obtain is fill all remaining NoData pixels value = 2 (Ground ID).
Does anyone know how solves this problem? I try to use Raster Calculator, but in my way it's not works.
I would appreciate. 😉