1

Can I loop a set of actions in model builder while a specific features rows are 1 or more.

Some background:

I have a point layer where I've created a workflow that:

first selects the row with the minimum value in a field containing distances to a line.

by using: [DISTANCE] in (SELECT min( [DISTANCE] ) FROM PointLayer) as my selection query.

I then create a buffer around this one selected point.

I plan to copy and append this point into some sort of result layer.

I then select by location and delete all points from the original PointLayer that are within the buffer with 'delete rows' or 'delete features' tool.

Now, since the original PointLayer is modified and some points have been deleted I want to restart the process and loop it until no points/rows are left in the PointLayer.

A new row will be the minimum since the old one was deleted in the previous run.

So the core question again, how can I make such a while loop in model builder and how do I apply the condition while rows> 0, I found there is a get count tool that counts rows.

Hornbydd
44.9k5 gold badges42 silver badges84 bronze badges
asked Mar 29, 2016 at 14:23
2
  • Sounds like you want to be using a WHILE iterator, this loops while something is TRUE. Commented Mar 29, 2016 at 15:25
  • Yes, any idea how I can apply my rows > 0 condition as input? Commented Mar 29, 2016 at 20:01

1 Answer 1

1

Based upon the logic you have described above the model you want is this: Model

The output of Get Count is a precondition to the Append tool and Buffer tool and is the input that is test for TRUE for the While iterator.

This model does not deal with the situation of when you have 2 or more points with the same minimum distance. In this case buffers will get built around both of these and processed.

answered Mar 30, 2016 at 16:41
3
  • This works good the only problem now is that it takes a very long time to execute because I have several thousand points and use small buffer zones to achieve the result I'm after. Commented Apr 14, 2016 at 13:41
  • May be you could try writing to IN_MEMORY to speed things up, have you added a spatial index, these can improve performance significantly? Commented Apr 14, 2016 at 15:59
  • Aha so setting all the outputs that will be temporary to write to in_memory/output ? I will try this thanks alot. About the spatial index, will look into this too. with the add spatial index tool? both things are new to me. I did try and modify the workflow to skip the buffertzone and use select by location that adds to the selection with the "with in a distance" option. thought that might be faster than creating buffer features. Commented Apr 14, 2016 at 17:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.