0

I'm using ModelBuilder in ArcGis to create model which can calculate some stuff from my raster.

At some point I have to multiply raster value and raster cell size. I've created variable Cell Size, but it doesn't appear in Raster Calculator 'Layers and Variables'.

enter image description here

I could manually type value reffering to cell size, but it's not the point. In the future I'd like to use that model to make calculations on other raster with different cell size.

Does anyone know how to use Cell Size in raster calculator?

1

Keeping this in your mind that the raster dataset may not always have square cells, you can use Get Raster Properties tool within a Calculate Value model only tool.

Assume the name of your DEM feature class/layer in your model is MY_DEM which has square cells. Then you can write Calculate Value's Expression part:

float(arcpy.GetRasterProperties_management("%MY_DEM%", "CELLSIZEX")[0]).

Last note, you need to define output of Calculate Value as variable and precondition to the subsequent tools. By default it generates an output name something generic, Value, and if you may rename this to something meaningful, say MY_DEM_CELL_SIZE, you can use this value by referencing to it as %MY_DEM_CELL_SIZE%

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.