Skip to main content
Question

How do I subtract rasters with different dimensions?

  • January 23, 2018
  • 1 reply
  • 176 views

Hello,

I have one raster who's extent is smaller than another, but I would like to subtract one from another with the resulting raster the same extent as the smaller one.

I get this error when using the RasterCellValueCalculator to subtract them:

 

RasterCellValueCalculator_Evaluator(RasterEvaluationFactory): Raster A has '12392' rows and '4022' columns, whereas raster B has '12435' rows and '4065' columns. Paired rasters must have the same dimensions

They are both 1 m cell size.

Thanks!

Sean

1 reply

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • January 23, 2018

When working with the rasterExpressionEvaluator, the rasters needs to have identical properties.

 

Make sure both rasters are in the same projection.

 

On the smaller raster use a RasterPropertyExtractor and then Clip the larger raster by the smaller with merge attributes checked.

 

 

The larger raster now covers the same areas as the smaller raster, but does not necessarily have the same dimensions. If necessary, use a Resampler and set the number of rows and columns to the _num_rows and _num_columns attributes. If necessary use a RasterGeoreferencer in extents modes, setting on the coordinates from the corresponding attributes.

Your rasters should now be perfectly aligned and can be used in the RasterExpressionEvaluator and also the RasterBandCombiner.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings