6

I am using ArcMAP 10.0

How do I add two raster datasets that overlap while maintaining the extent of the larger raster dataset. I have thought of adding zero values to the smaller raster to then be able to add them both together in raster calculator.

Is anyone familiar with a better way to achieve this?

My data is deposit thickness data, and I want to preserve the extent of the larger raster which the smaller raster is confined within when adding their elevations together - as currently when adding the data together I just get an output raster where the data overlaps.

3

If I understand your situation correctly, and assuming you have access to the Spatial Analyst extension and want to avoid implementing a coded solution, I think what you want is the tool "Mosaic to New Raster".

http://resources.arcgis.com/EN/HELP/MAIN/10.2/index.html#//001700000098000000

Just make the prompts match the original data (ex. pixel type, cell size, SRS, etc.) but for the "mosaic_method" parameter use "SUM".

Hope that works. Let me know if this is not what you were going for.

Edit (To work with ArcGIS 10.0):

To do this in ArcGIS 10.0 and below (when you don't have access to the SUM feature in Mosaic to New Raster) the following outlines a strategy that I think will work. Forgive me, it is a bit hard to test without myself having access to 10.0. Also, you will need the Spatial Analyst extension to use the below mentioned tools.

These doc pages should help you noodle out the solution:

Con

http://help.arcgis.com/EN/arcgisdesktop/10.0/help/index.html#//009z00000005000000.htm

Making Con expressions

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00p60000000p000000

Raster Calculator

http://help.arcgis.com/EN/arcgisdesktop/10.0/help/index.html#//009z000000z7000000.htm

So, the general workflow you will want is to either make an expression to be used in the Raster Calculator or to use a series of map algebra tools standalone (basically doing the steps from the raster calc manually and step by step). Whichever seems easiest for you.

I think you will want to do something like this with the Con tool:

in_conditional_raster = Raster(small_raster)

in_true_raster_or_constant = Raster({small_raster}) + Raster({big_raster})

in_false_raster_or_constant = Raster(big_raster)

where_clause = pretty sure this should just be left blank

So if all goes well, and I understand your datasets correctly, the above should search for areas that contain the small raster (true condition), if they find them they will create a new raster with the summed values of small_raster and big_raster. Then for areas not in the small_raster (false condition) it will just populate with values from the big_raster.

Hope this works!

| improve this answer | |
  • 1
    Chaz you are on to something great here I have tried computing this but i do not have a mosaic_method parameter in 10.0 - instead i have mosaic operator which gives me the options (First, Last. Blend, Mean, Minimum and maximum). Blend tool is the closest i found to sum and in the help bar says BLEND - "The output cell value of the overlapping areas will be a horizontally weighted calculation of the values of the cells in the overlapping area. " this sounds great but having calculated the output have taken the values away and i want to sum them as you have detailed. – Jordan Sep 22 '15 at 13:51
  • My apologies, you did mention you were using 10.0, I guess they didn't add the SUM feature until 10.1 or 10.2. I guess you will just have to ask your uni lab to lay out the dosh for the new version ;) Haha, or, you could try "raster calculator" or just the "con" tool. I will update my answer and try to highlight how to do this. – Chaz Sep 22 '15 at 14:03
  • Updated. See if you can get the above workflow to work. Good luck! – Chaz Sep 22 '15 at 14:14
  • Hi Chaz, I understand what you mean I have entered this -////- Con("mosquitoghaut", ("mosquitoghaut" + "tuittsghaut"), {"tuittsghaut"}) -////- mosquitoghaut being my small and tuitts being my big - however i get this as my error -////- ERROR 000989 Python syntax error: Parsing error : invalid syntax (line 1) -////- It seems i need to enter values? – Jordan Sep 23 '15 at 10:55
  • Hmm, sorry, I feel like I am sending you on a wild goose chase here. I also may be complicating matters more than necessary. A similar topic is discussed here if its helpful: geonet.esri.com/thread/26417. Also though, I just tried this out on some test datasets and it worked. Couldn't you just do your plus calculation and then mosaic to new raster with the output plus and the bigger dataset? Then choose the mosaic method as either first or last based on which order you added your datasets to the input (note, you want your summed output raster on top of the big one). – Chaz Sep 23 '15 at 13:46
3

The correct way would be to click on the Environment Settings button on the bottom of the Raster Calculator Window.

A new window pops up where you can choose the processing extent of your calculation.

enter image description here

Here you can choose between intersection, union, user specific... Additionally if rasters are loaded you can choose one of them. In your case I would choose the bigger one.

| improve this answer | |
  • "Union of inputs", is the most straightforward one. :) – Joe DF Nov 30 '16 at 15:55
  • I think this always depends on the way the two rasters overlap. But for some cases you are right. – Generic Wevers Nov 30 '16 at 15:58
0

Its a bit of a low-level answer but here goes. assuming you know the pixel size you can calculate where the small raster is within the larger raster and only add to values within the confines of the small raster; something along the lines of this should work(intended as pseudocode):

startleft = int((largecornerleft - smallcornerleft)/pixelsize);
starttop = int((largecornertop - smallcornertop)/pixelsize);
endleft = startleft + xnopixelsinsmall;
endtop = starttop + ynopixelsinsmall;

for(j=0;ynopixelsinlarge;j++){
   for(i=0;xnopixelsinlarge;i++){
      if(i >= startleft && i < endleft && j >= starttop && j <endtop){
      largeraster[j][i] += smallraster[j-starttop][i-startleft];
      }
   }
}

EDIT: faster version of loop:

for(j=0;j<endtop;j++){    
   for(i=0;i<endleft;i++){
   largeraster[starttop+j][startleft+i] += smallraster[j][i]];
   } 
}
| improve this answer | |
  • That's great - Thank you very much - I am an amateur student user how do I go about running this code for the rasters in ArcGIS 10.0? Raster Calculator? – Jordan Sep 22 '15 at 11:21
  • sorry, i'm not familiar with ArcGIS, it was just intended to show you how to do what you want in a C/java style language (also a student here) – willsta Sep 22 '15 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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