3

How do I add rasters together that are of different spatial extents?

I have many, many features that overlap over a large area (entire east coast) and I am looking to sum them "stacked" where they overlap. My strategy is to:

1) Convert each feature to a raster (using Polygon to Raster tool)

2) Set Null values for feature to 0 using Con(IsNull("raster"),0, "raster") in Raster Calculator

3) "Normalize" each raster (spatially) to have matching spatial extent (of the entire study area) - do this by adding each raster to the "Constant Raster" I created, which has the study area's extent, the same projection, and the same cell size of the individual rasters. The result should be a new raster to the extent of the study area, with the same correct values at the location of the converted-feature in question.

4) Use Raster Calculator to simply add the normalized rasters together.

Something's not working at step #3. When I add the projected, constant raster (all values = 0) to the individual feature-converted-to-raster (with null values set to 0) in the Raster Calculator Tool, with Processing Extent set to that of the Constant Raster, the resulting raster output is of the correct extent but the values of the feature-converted-to-raster are incorrect. Instead of an expected range of, for example, [0, 77] (where the feature that was converted had the value 77, and any "background" value = 0) the value is something extreme, such as [-1.79e+308, 1.79e+308] [Edited to explain unexpected output]

Can someone explain what it is I am missing here? My searches on StackExchange only revealed this question but I must have missed something.

  • Could you please say a little more about how the values are "not calculated correctly"? – whuber Sep 25 '13 at 20:47
  • 1
    Sounds like you need to set the environment setting "Snap Raster" when you convert the feature to a raster, Set it to the constant raster you created. – Hornbydd Sep 25 '13 at 20:58
  • @Hornbydd, great suggestion thanks, but I did do that, set the snap raster to the constant raster, and still not expected output. – SharonB Sep 26 '13 at 13:22
5

I just generated 3 rasters that did not have the same extent and was able to add them. These are the steps I followed - fairly similar to yours, but no "normalizing".

  1. I did this the same as you (default processing extent used here)
  2. Set the processing extent to cover the whole area - I did this manually - but this is when it needs to be set - you can set yours as the constant raster. My formula looked a bit different then yours: Con(IsNull("raster"),0, "raster")
  3. I could visibly see that all of these rasters had the same extent (did your's visibly cover the same area?) - which was created in the last step by setting the processing extent.
  4. Added the rasters in Raster Calculator - and the values were exactly as expected.
  • Thanks for doing your own test run. I wonder what I was doing wrong, because I attempted the (your) correct protocol originally, and it didn't work. Thanks again! – SharonB Sep 26 '13 at 14:36
2

Solution for ArcToolbox 10.3 Step 1: Clip smaller raster with extent of larger one and check "Maintain Clipping Extent" which garantuees that the pixels of the two rasters are at the same position. Then set "noData value" = 0 (not sure if the last point is really necessary ;-) ) --> The values in the area of the smaller raster aren't 0 after this process but have the value "noData"

Step 2: "Raster calculator" : Con(IsNull("smaller clipped raster"),0, "smaller clipped raster") sets the values of the smaller clipped raster to "0" where was noData

Step 3 : "Raster Calculator" : Whatever you want to calculate with the two rasters

1

I've run into a similar issue as @SharonB yesterday and though I'd share the solution which worked for me. Instead of using 'Raster Calculator, I've used a different tool called 'Cell Statistics' (also part of SA Toolbox), with 'SUM' option of overlay stats. Beforehand I've generated a constant raster with the correct extent, to which I pointed in the 'Environments' --> 'Processing Extent'. The resultant raster had correct extent versus only area of overlap using raster calculator.

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.