4

I am working in ArcMap 10.3 and I would like to merge two rasters, one of wheat harvest area, the other of corn harvest area. Looking at the corn rasters table shows the amount of corn harvested in that pixel. I would like to combine the two and get a value for the highest. I am thinking something like set corn to 1 and wheat to 2. Whenever corn is higher than wheat assign a 1 and so on. The output raster then have every pixel showing a 1 or 2 to represent which of the two was higher in that location. Both rasters have the same spatial extent

Can this be done?

I have been reading through the tool list and have not found any tools that look like they will do the job.

2
  • Do you have the Spatial Analyst extension?
    – FSimardGIS
    Sep 23, 2016 at 17:08
  • Yes I do have this.
    – Jeffkrop
    Sep 23, 2016 at 17:23

2 Answers 2

7

You can use the Raster Calculator. Something like this should get you what you want:

Con("corn.tif" > "wheat.tif", 1, 2)

Update for additional question in comments:

I would do this in a two step process. Take all 5 rasters and run a Cell Statistics. Set the Overlay Statistics value to Maximum. This will give you the largest value per cell out of the 5 rasters. Now use raster calculator to do the following:

Con("rasterA.tif" == "cs.tif", 1, Con("rasterB.tif" == "cs.tif", 2, Con("rasterC.tif" == "cs.tif",3, Con(rasterD.tif" == "cs.tif",4,5))))
5
  • This works, I just had to remove the zero from the data.
    – Jeffkrop
    Sep 23, 2016 at 17:26
  • Ok so now how do I do it with 5 different crops?
    – Jeffkrop
    Sep 23, 2016 at 17:57
  • @Jeffkrop, edited the answer for 5 rasters.
    – Brian
    Sep 23, 2016 at 18:31
  • There is pick function or similar in sa
    – FelixIP
    Sep 23, 2016 at 18:42
  • After taking the weekend to look over this I now see that the expression Con("corn.tif" > "wheat.tif", 1, 2) shows ONLY where corn is greater than wheat and leaves the rest of where corn is off. So if there is a place where corn grows and wheat does not it will not show anything. The Cell Statistics with the long Con does something similar, but with that one if you put in wheat before corn before soybeans before rice it shows something then if you change the order it shows something else.
    – Jeffkrop
    Sep 26, 2016 at 17:07
2

The correct tool for this sort of analysis is Highest Position

You don't need to do cell statistics prior to using it. It accepts list of raster and determines on a cell-by-cell basis the position of the raster with the maximum value in a set of rasters, e.g.

example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.