Skip to main content
Question

How do I subtract rasters with different dimensions?

  • January 23, 2018
  • 1 reply
  • 241 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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

jdh
Contributor
Forum|alt.badge.img+37
  • Contributor
  • 2002 replies
  • 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.