Select to view content in your preferred language

Get values of one raster into the other?

8968
10
Jump to solution
02-03-2015 02:13 PM
KatjaSchafroth
Deactivated User

Hi everyone. I have two different rasters, they have not the same cell size. I would like to do some kind of overlay so that the values of the 2nd raster (the purple/pink) replaces the values of the (blue) 1st raster and if two raster cells with different values of the second raster overlay one raster cell from the first raster, the value of the cell which takes more space will be taken.

So I would like to have the blue raster as an output whit the values of purple/pink one. Is this possible?

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Yes you can do this, but it is not a very good thing to do, to overlay rasters that have different resolutions and don't seem to align. But, if this is what you have and you still want to proceed, you can do this with the Raster Calculator (I assume you have Spatial Analyst):

RasterCalc.png

With this formula, you will create a new raster that will have the values of the second raster where the first raster is Null (has NoData. If the first raster has values, they will be written to the output.

Before you press OK, you should enter the Environments and specify how to handle the difference of resolution. Set Processing Extent to the raster you want to use (or use Union for the combination of both extents or Intersect for the area they have in common) and select the Snap Raster (also in Processing Extent) . Set the Cell Size in Raster Analysis.

Although you define how the output should be created you have little influence over how partly covered cells will be handled.

You could also convert both rasters to polygons, perform a union and using the attribute table of the resulting featureclass, guide the way you want your outcome to be (write this to a new field). The result can be converted back to raster (using the field you created in the previous step).

View solution in original post

10 Replies
DanPatterson_Retired
MVP Emeritus

For best results, align the rasters with respect to their extent and cell size, convert nodata to 0, then employ a conditional operation

0 Kudos
KatjaSchafroth
Deactivated User

Sorry for the late answer. Thank you for your help, I will try this out, too!

0 Kudos
XanderBakker
Esri Esteemed Contributor

Yes you can do this, but it is not a very good thing to do, to overlay rasters that have different resolutions and don't seem to align. But, if this is what you have and you still want to proceed, you can do this with the Raster Calculator (I assume you have Spatial Analyst):

RasterCalc.png

With this formula, you will create a new raster that will have the values of the second raster where the first raster is Null (has NoData. If the first raster has values, they will be written to the output.

Before you press OK, you should enter the Environments and specify how to handle the difference of resolution. Set Processing Extent to the raster you want to use (or use Union for the combination of both extents or Intersect for the area they have in common) and select the Snap Raster (also in Processing Extent) . Set the Cell Size in Raster Analysis.

Although you define how the output should be created you have little influence over how partly covered cells will be handled.

You could also convert both rasters to polygons, perform a union and using the attribute table of the resulting featureclass, guide the way you want your outcome to be (write this to a new field). The result can be converted back to raster (using the field you created in the previous step).

KatjaSchafroth
Deactivated User

Can I somehow manage that only the values of raster 2 will be in the output?

0 Kudos
XanderBakker
Esri Esteemed Contributor

If you want the values of the second raster where the first raster is defined and the rest set to NoData, then the formula would be:

Con(IsNull("FirstRaster"),"FirstRaster","SecondRaster")

0 Kudos
KatjaSchafroth
Deactivated User

But if I do this, the cellsize of my output raster wil have the cell size of my second raster?

Sorry for troubeling you so much!

Probably I just convert the first raster to points, then extract the values of the second raster to the points and then convert this back to raster?

0 Kudos
XanderBakker
Esri Esteemed Contributor

The cellsize of the output is managed by the environment settings as I stated in my first answer:

Before you press OK, you should enter the Environments and specify how to handle the difference of resolution. Set Processing Extent to the raster you want to use (or use Union for the combination of both extents or Intersect for the area they have in common) and select the Snap Raster (also in Processing Extent) . Set the Cell Size in Raster Analysis

Use the input raster for which you want the output raster te have the same cell size and extent.

0 Kudos
KatjaSchafroth
Deactivated User

Ah yes, I forgot it that time. Now it workes just like I wanted, even if I do not totally understand at wich level of share partly covered cells are defined the one or the other value.

Thanks a lot for the patient explanation!

0 Kudos
KishorGhatage
Deactivated User

Also you can use 'Mosaic to new raster tool'. First add the purple/pink and then add blue raster and set the Mosaic operator to Last.

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

Hope this is helpful

Kishor

0 Kudos