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.

  • 1
    How did you get on? Once it's working you should either accept my post as a solution if it fixed it, or you should post your answer, so other people with the same problem can find the solution :) – Dan_h_b Jun 11 '15 at 8:48

%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

  • Pardon me if this should be asked in another question, but is it possible to do the same thing in QGIS's (or any other GIS) model builder? I have near 7000 points and the process seems really slow. – Nahas Jun 11 '15 at 20:10
  • 2
    It would be best to ask this as a different question. 7000 points is a very small dataset, so it should run quickly. Put in a new question with a full image of your model as well as a description of the point dataset, i.e. number of fields, if it is indexed etc.... and where you are reading the data from and writing to, including file formats. It is likely there are some simple tweaks you can make to speed this up. – Dan_h_b Jun 12 '15 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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