Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an Arcgis (10) model which has 2 process that need to be run sequentially.

The 1st process is a python script that creates multiple rasters, but that output is not known to ModelBuilder, therefore I can't use it as a precondition. Or at least not as outline in Example #1 in that page. Maybe there's another route I haven't discovered.

The 2nd process needs those rasters in order to operate. How do I let #2 know when #1 is complete so it may start execution?

To reproduce build a model with:

Process_1: a script which runs PolygonToRaster several times, converting each field in the attribute table to a raster (here, but field list will need to be edited).

Process_2: Run LessThanFrequency Spatial Analyst tool on the results (but really the tool doesn't matter).

share|improve this question
I think you probably need to use SetParameter or SetParameterAsText at the end of your script to indicate successful completion and then also add it as an output (derived) parameter to the properties of the tool. That should take care of "but that output is not known to Model". – PolyGeo Jun 2 '12 at 0:49
up vote 4 down vote accepted

As @PolyGeo mentioned, add a fourth parameter to your script tool with the following properties:

  • Data Type: Raster
  • MultiValue: Yes
  • Type: Derived
  • Direction: Output

Then, in your script, build up a list of paths to your output rasters. Upon completion, join them as a semicolon delimited string and pass that to SetParameterAsText to set the derived parameter.

You should then be able to directly connect the script tool to the Polygon to Raster tool.

share|improve this answer
Thank you. I had a hell of a time getting SetParameter to work properly. I can't put my finger on exactly what makes it so difficult to use, but it is! In the end what made the critical difference is remembering/knowing that the index number used in the script must match the exact order that the parameters are set in the Toolbox item properties, and that the 1st parameter is 0. This would be better if the parameters were names instead of numbers. As it is now it's too easy to change either the script or the toolbox and get them out of sync with each other. – matt wilkie Jun 11 '12 at 17:03
for those that follow: <type 'exceptions.RuntimeError'>: Object: Error in setting parameter as text might mean you're using the wrong index number, e.g. SetParameter(4, something) when you really mean SetParameter(3, something) – matt wilkie Jun 11 '12 at 17:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.