Select to view content in your preferred language

Using iterative Model Builder outputs in raster calculator

4784
4
09-10-2012 08:32 AM
HelenGoodchild
Regular Contributor
Hi,
I was trying to create a very large cumulative viewshed using the model builder. So far my model takes multiple observer points and uses them to create lots of outputs. This seems to work fine and I end up with lots of viewshed files in my directory.

[ATTACH=CONFIG]17574[/ATTACH]

The next stage I wanted to do was to add all of those outputs together in raster calculator to make one single cumulative viewshed. Is there a way of automating this in ModelBuilder or is there a better way of achieving this? Better still, is there a way that will end up with a single output, without creating all those interim viewshed files?

Many thanks,
Hen
0 Kudos
4 Replies
KailaiZhang
Emerging Contributor
Hi Helen,

For ArcGIS 10 or above, you can use the Collect Values tool to collect the Viewshed outputs from the iterator and then use tools like Cell Statistics to add them up.

The Collect Values tool is under Insert on the Model Builder Window > Model Only Tools > Collect Values

Accessing Model Only tools: http://resources.arcgis.com/en/help/main/10.1/index.html#//002w00000066000000

Collect Values: http://resources.arcgis.com/en/help/main/10.1/index.html#//004000000005000000

Thanks,

Kailai
0 Kudos
HelenGoodchild
Regular Contributor
Thanks, I saw Collect Values but couldn't quite twig that cell statistics would replace the raster calculator! Works perfectly. The only real problem is that it will create thousands of interim raster files which I ultimately don't want. I guess there's no real way around that one as they are needed for the stats part...

Cheers!
0 Kudos
KailaiZhang
Emerging Contributor
Hi Helen,

Please try and see if you can make the interim raster files as intermediate data (right click the model element > Intermediate), then you can put them in a scratch workspace or in-memory workspace, and can delete them manually afterwards by clicking Model menu > Delete Intermediate Data

A quick tour of managing intermediate data:
http://resources.arcgis.com/en/help/main/10.1/index.html#/A_quick_tour_of_managing_intermediate_data...

Deleting intermediate data:
http://resources.arcgis.com/en/help/main/10.1/index.html#/Deleting_intermediate_data/002w00000039000...

But you probably can run the Viewshed tool directly without model builder if you goal is to add all the single-observer viewshed results together in the end. The Viewshed tool can accept multiple observer points as input. 

�??The output will only record the number of times that each cell location in the input surface raster can be seen by the input observation points (or vertices for polylines). The observation frequency will be recorded in the VALUE item in the output raster's attribute table.�?�

Viewshed: http://resources.arcgis.com/en/help/main/10.1/index.html#//009z000000v3000000

I am not sure if there is a special reason you have to go through the iteration in model builder. But just to make sure you know about it.

Regards,
Kailai
0 Kudos
PSch
by
New Contributor
Hey Kailai,

I was stuck with a similar problem and found your post very useful.  Using the Collect Values tool to collect raster outputs from an iterator and then use the tool Cell Statistics to sum up the results, was my solution so far.

However, now I ran into the next problem:

I do have many large input shape files, which I need to process separately with a model using a feature iterator and then, as u described above,  using Collect Values and Cell Statistics. I used to do this with the batch processing function (http://www.lib.uoguelph.ca/resources/data_resource_centre/help_&_learning_resources/geospatial_help/...).

However, the cell statistics tool does not allow me edit the output location within the batch dialogue box (after right clicking on the model, batch). Thus, I cannot run the model on several input files. I guess it is a buck of the combination of cell statistics and collect values. Only the combination of those 2 tools resulted in this problem.
I wonder if you know any solution of my problem.
Potential solution could be:

�?� Fixing the problem with the output location within the batch dialogue box.
�?� Substituting the combination of cell statistics and collect values by anything else resulting in the same outcome.
�?� Using any other possible way to run a feature iterator on several feature classes (something like a nested iterator)

Thanks
MGR
0 Kudos