Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 two polygon feature classes, an alignment layer and a parcels layer. I am trying to use ModelBuilder to create a tool that will do the follow:

  1. iterate through groups in a single field of a polygon alignment layer (ie select and iterate through certain attributes in a field with same names such as "tunnel", "portal", etc)
  2. Clip a parcel layer by each group
  3. Populate a new field in the parcel layer called "EsmtType" with the name of each group (group is called "Value" in model)
  4. Merge the clipped groups into one feature class

I have gotten steps 1 and 2 to function but I am stuck on step 3. I am not sure how I need to configure the "Calculate Field" tool in order to recognize the "Value" variant of the "Iterate Feature Selection" tool. I tried using the advice from this post Using a value from "iterate feature selection' to calculate a field but I couldn't figure out how to implement it for my situation.

Here is the model I have thus far:

I would also like advice on how to implement step 4, I am not sure if it would require integrating a model within a model.

Thank you so much!!! -kkaszas

share|improve this question
Could you please describe how you use the alignment layer? – Aaron Jun 26 '13 at 22:01
Its a polygon layer that I am trying to use as the clip feature for my input parcel layer – kkaszas Jun 26 '13 at 22:19
Could you expand step four? Does the precondition prevent the merge from 'firing' too often? When I've run similar models, it has run a merge for each iteration, substantially increasing model run an unacceptable level. – Mox Apr 22 '14 at 23:44

I remember struggling with this in ModelBuilder as well, and the method I eventually came up with is this:

enter image description here

An expression is built using the Calculate Value tool with Value as an inline variable. It will return a string containing the current Value which can be used as the expression for the Calculate Field tool.

share|improve this answer
Thanks Arabella! I will try this out. – kkaszas Jun 27 '13 at 15:24
When I try to change the default expression of calculate value to anything other than the default, the connector between "value" and "calculate value" disconnects. I was also having this problem before I was using "calculate value" and just trying to connect "Value" straight to "calculate field", whenever I would alter the expression or code block the connector would disappear. Here is a screen shot showing the defaults, any idea what to do about this? – kkaszas Jun 27 '13 at 18:21
Value should be set as a precondition to Calculate Value. This ensures that the expression is constructed after the current value is updated, so the connector between Value and Calculate Value should be a dotted line. You can then fill in the Python code. – Cindy Williams Jun 28 '13 at 5:24
up vote 1 down vote accepted

The solution to implementing step 3 was very simple. I actually didn't need to use "Calculate Value" before "Field Calculator" to make it work as @Arabella had suggested. The main piece of information that helped me was @Arabella telling me about preconditions. I set a connection between "Value" and "Field Calculator" as a "precondition" (which shows up as a dotted line), I then used the following expression in the field calculator: "%value%" and I set the expression type to PYTHON. This worked perfectly.

Below is a link to a screen shot of the functioning model (steps 1-3). I now need to implement step 4. The advice I have been given from the Esri forum is "To merge the clipped outputs you will need to use the Collect Values tool to collect the outputs of clip, make that output a parameter and drag that into a different model, the output of Collect Values would then be an input to the Merge Tool (data management)." I will test this.

EDIT: I have successfully implemented Step 4. I used the "Collect Values" tool to create a repository of my output clips. I then used the Merge Tool (data management) to create a single feature class, I made the output a parameter.

Tip: If you want to use this model but you dont want to iterate through selections of every record group then prior to running the tool, set a definition query (on the feature you want to use to clip by) to include only the attributes you want to iterate.

The final working tool:

enter image description here

share|improve this answer

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.