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.
-
Sounds like you want to be using a WHILE iterator, this loops while something is TRUE.Hornbydd– Hornbydd2016年03月29日 15:25:11 +00:00Commented Mar 29, 2016 at 15:25
-
Yes, any idea how I can apply my rows > 0 condition as input?SupKre– SupKre2016年03月29日 20:01:33 +00:00Commented Mar 29, 2016 at 20:01
1 Answer 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.
-
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.SupKre– SupKre2016年04月14日 13:41:09 +00:00Commented 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?Hornbydd– Hornbydd2016年04月14日 15:59:14 +00:00Commented 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.SupKre– SupKre2016年04月14日 17:04:09 +00:00Commented Apr 14, 2016 at 17:04
Explore related questions
See similar questions with these tags.