Wednesday 29 July 2015

arcgis desktop - Fixing Model with Iterate selected feature?


I have a Shapefile with point features representing pour points. I need to delineate their watersheds individually, because many of them overlap.


I'm using the following model to select a point from the Shapefile, export it in a new layer, delineate it's watershed with the Watershed tool, and then repeat for the next point. I want each new layer (of point and watershed) to have the FID as the file name, so I'm using %FID% as the output.



enter image description here


It keeps failing. What's wrong with my model? I'm relatively new to ModelBuilder.



Answer



%FID% is what is known as an in-line variable. However, you have not exposed a variable called FID at the moment. If you replaced this with %Value%, your model would work, and the outputs would have the name of the "Value" coming out of your iterator.


There are 2 options to do what you are trying to do:



  1. Within the Iterator, Group by FID. This will mean that the "Value" that comes out of the iterator is the FID. You can then use %Value% as your output name.


enter image description here




  1. You can use the model only tool "Get Field Value" after the iterator to get the FID for the feature. You can then use the output from this as your output name (in the image below you would use %FID%). But make sure you make this output a pre-condition to the Watershed tool. Sorry I've not finished linking the full model below, I don't have a flow raster to hand, but hopefully you can see the steps.


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...