Mosaic to New Raster not accepting Iterator output as input.

5479
14
Jump to solution
10-20-2016 01:00 PM
KevinSmith2
New Contributor II

I have an ArcGIS Pro model that iterates through a series of folders(using a workspaces iterator), passes those folder names off to a new model that contains a raster iterator. I am having trouble passing the rasters found using the raster iterator to the Mosaic to New Raster Tool(in the original model). The Mosaic to New Raster tool, is not recognizing the output from the raster iterator as an input for the tool.

Additionally, I think that the all of the output from the workspace iterator might not be being transferred as the input to the raster iterator. (I can only see the first one being transferred).

I have a very similar model that works in ArcGIS Desktop without any problems, but I would like to have the extra RAM that ArcGIS Pro affords as some of these raster are gigabytes big.

Any Help is appreciated

Kevin

0 Kudos
1 Solution

Accepted Solutions
DuncanHornby
MVP Notable Contributor

Kevin,

Now it's my turn to say I should have mentioned...

Your model is horribly inefficient!

Mosaic to new raster takes as input a list of rasters. A model with an iterator causes everything to get executed the same number of times as the iterator loops. You want a SUB model with that iterator and the output feeds into a collect tool which is exposed as a parameter. Then you drag that SUB model into a MASTER model which has only one tool, your mosaic tool. The Collect Values tool spews out a LIST, in your case a list of rasters which feeds nicely as a single input into the mosaic tool.

View solution in original post

14 Replies
DuncanHornby
MVP Notable Contributor

If I have understood you correctly you want to mosaic ALL the rasters in your various workspaces into a SINGLE raster? 

If this is correct the solution would be to do away with the iterator for workspaces.

You should have only one iterator (the raster iterator) that collects ALL the rasters and feeds them all into the mosaic tool in one hit. You can achieve this by ensuring the RECURSIVE parameter is ticked on in the raster iterator and that all your raster workspaces sit within one folder and point the iterator at that top level folder.

Make sure you don't have other unwanted rasters buried within those workpsaces as they might get picked up unless you are using a wildcard.

KevinSmith2
New Contributor II

Duncan,

Thank you for your reply, however simplifying the model kind of helped. The mosaic to new raster tool did take the output from the iterate raster tool as an input however nothing is actually created, and the mosaic tool does not show any colour.

I should have mentioned earlier, that the reason I had the workspace iterator in the previous model was due to the size and number the rasters. There were so many rasters, and they were so big, it was crashing ArcMap. That is one of the reasons I wanted to try Pro, hoping I could use more of the computers RAM.

0 Kudos
DuncanHornby
MVP Notable Contributor

Kevin,

Now it's my turn to say I should have mentioned...

Your model is horribly inefficient!

Mosaic to new raster takes as input a list of rasters. A model with an iterator causes everything to get executed the same number of times as the iterator loops. You want a SUB model with that iterator and the output feeds into a collect tool which is exposed as a parameter. Then you drag that SUB model into a MASTER model which has only one tool, your mosaic tool. The Collect Values tool spews out a LIST, in your case a list of rasters which feeds nicely as a single input into the mosaic tool.

KevinSmith2
New Contributor II

Duncan,

Thanks for the feedback, the last model was defiantly a butcher job... I integrated my old raster iterate model(which had the collect values) as a sub model to master model. It looks like it is passing the list from the sub model to the master model, however the mosaic tool is still not functioning. Any thoughts?

0 Kudos
DuncanHornby
MVP Notable Contributor

OK looking at your screen shots, this is a much more efficient way of running this, so it's not an issue with general workflow logic. You have greyed out tools (the iterator and the mosaic tool). This can only mean one of two things, you have either not filled in all the mandatory inputs OR you have put something in that is invalid.

 I spoofed up a sub-model and as you can see it has ALL coloured in, when I open my iterator this is what I had. You need to go back and check your inputs and make sure the model completely colours in, then you know it has valid inputs.

Sub model example

KevinSmith2
New Contributor II

I think that it is something happening at the mosaic raster tool in model builder? All the parameters are filled in and I am not getting any error messages (either the red asterisks or in the geoprocessing results), but I am still not getting any output.

When I run the same geoprocessing tool(albiet with less rasters), with the exact same parameters, I get an output raster.

I wonder if there is a limit on the amount of rasters, or am I missing something obvious?

0 Kudos
curtvprice
MVP Esteemed Contributor
I have a very similar model that works in ArcGIS Desktop without any problems, but I would like to have the extra RAM that ArcGIS Pro affords as some of these raster are gigabytes big.

Have you tried running your Desktop-authored model that works? The model created in Desktop should run fine. All Desktop toolboxes and tools should run correctly in ArcGIS Pro unless you include tools or data types (ie .mdb) that are not supported in 64 bit arcpy.

Also, if your model tools are set up to use Desktop 64-bit processing, (always run in foreground unchecked) and x64 background Desktop geoprocessing is installed, your Desktop tools can use that extra RAM you seek, as they will run in x64 arcpy. In that case you can avoid Pro here until it gets a little less buggy (new version 1.4 is on the way).

0 Kudos
DuncanHornby
MVP Notable Contributor

For the record I have recently been running the mosaic to new raster tool using python and in some cases was chucking in excess of 17,000 rasters at the tool and it did not blow up!

Also agree with curtvprice, now you have stream lined your model, try it in Arcmap? 

NathanSchlagel
New Contributor II

Apologies if I should ask this in a new thread. I am having issues with a similar workflow. I have dem data for several different sites, each with several tiles covering the areas. I want to mosaic each site individually rather than the entire data set.

Trying to follow the workflows discussed above, I'm using one submodel to iterate each site folder as a current workspace (1) within another submodel iterating that workspace's rasters into the collect values tool (2), then passing that into the master model that runs the mosaic on the given site's raster list (3), then hopefully starting over and running the next site through all steps in the model chain.

My problem is it seems the workspace and or raster iterator is running and only sending the last site file on to the mosaic tool in (3). I.e. If I have site 2 alone it will mosaic site 2 properly; if I add site 5 to the test folder it will only output a mosaic of site 5's tiles (though it does that site properly). Similar if I add site 6 it will skip 2 and 5 and only output site6_mosaic. I'm just doing small folder sets as a test, there's a lot more, hence I'm trying to figure out the model to iterate all of it.

0 Kudos