Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

My goal is to create shapefile that contains merged feature classes from a geodatabase. I would like for there to be a new field in the resulting shapefile that contains the name of the original feature class. The tool that I have created is successful in merging the FCs into one shapefile however the "Name" field is blank for ever record.

The field that is intended to be populated is set up as a text field (length 50). I have set the "Name" variable from Iterate Feature Classes as a precondition to calculate field. My expression in Calculate field is "%Name%" with Expression Type Python.

What do I need to change to make this work? Thanks!

Link to Image : http://imgur.com/R0h4U78

enter image description here

share|improve this question
1  
I think your model needs to include Parse Path. –  PolyGeo Sep 12 '13 at 21:49
1  
Thanks, this worked. –  kkaszas Sep 12 '13 at 23:12

2 Answers 2

up vote 3 down vote accepted

I followed the suggestion provided by @PolyGeo and I used the "NAME" component of Parse Path to populate Calculate Field. I connected the "Value" variable from Parse Path as a pre-condition to Calculate value. This solution was successful. This is what my final model looks like:

http://imgur.com/cYnbBvb

enter image description here

share|improve this answer
    
@PolyGeo - why is it necessary to use Parse Path - Parse Type:Name when this value is already available through the Name variable from the iterator? –  Nxau Sep 17 '13 at 12:15
    
@PolyGeo, I have the same question, when I used the iterator "Iterate Feature Selection", I was able to directly link the "Value" variable to the Field Calculator. gis.stackexchange.com/questions/64562/… –  kkaszas Sep 17 '13 at 16:10

Your calculate field expression is ok. It should produce the intended result. I would modify the model so that the merge is done in a separate model that calls a sub model. Sub model copies features, adds and calculates field with feature class name, collects and passes the values to merge tool in the main model.

share|improve this answer

Your Answer

 
discard

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.