Select to view content in your preferred language

How to iterate raster calculation from one raster in model builder

893
2
12-19-2013 02:29 AM
LeoRegazzoni
New Contributor
Hi!
I have a DEM that i want to split in to many thresholded rasters. I would like to have one raster for every 0,5 m with the condition "true = above n meter" and "false = below n meter". To do this with the raster calculator is easy and can be done for example with this expression: "DEM > n meter". This will give me a raster where all values above n meter is 1 and all value below is 0.

My quistions is: How and wich iterator can I use in model builder to get rasters for every halv a meter of the DEM.

I'm new to the iterator and have not got fully understood the tool so if you have a answer, imagine explaining this to 4 year old 🙂

Thanks in advance, Leo
0 Kudos
2 Replies
GeraldineEGGERMONT
Deactivated User
Hi Leo,

You can do this using the "For" iterator. In this iterator you have to set a 'from' value and a 'to' value (here it depends on the value range of your DEM), and an incremental value (0.5). The tool you connect to 'Value' will execute for each value in the range you specify.
Add the Raster Calculator to your model, open it and build your expression by dragging the DEM and the 'Value' variable from the 'Layers and Variables' window to the expression window (see attached image). Don't forget to add '%Value%' to the name of your output, otherwise you will overwrite the same output raster n times. This will not work with negative values though, as hyphens can't be use to name datasets.
0 Kudos
LeoRegazzoni
New Contributor
Hi Leo,

You can do this using the "For" iterator. In this iterator you have to set a 'from' value and a 'to' value (here it depends on the value range of your DEM), and an incremental value (0.5). The tool you connect to 'Value' will execute for each value in the range you specify.
Add the Raster Calculator to your model, open it and build your expression by dragging the DEM and the 'Value' variable from the 'Layers and Variables' window to the expression window (see attached image). Don't forget to add '%Value%' to the name of your output, otherwise you will overwrite the same output raster n times. This will not work with negative values though, as hyphens can't be use to name datasets.


Hi!
Thank you for your answer.
I still have some problem executing the task. It seems like the For iterator only handle integer values (datatype Long), so I can't set the incemental value to 0.5.
Is there a way to work around this or do I have to settle with 1 as a incremental value?

// Leo
0 Kudos