how to select by attributs in modelbuilder with iterate?

2482
5
Jump to solution
04-04-2014 04:41 AM
by Anonymous User
Not applicable
Original User: edorheim

Hi

I've tried to find an answer to this question on the forum since there is quite a few that seems similiar, but I can't find an answer to my question in them, so if you know that this has been answered before, please redirect me.

I have crated a model that iterates GPX-files from a folder and works through it and gives me a raster as output with pixel values after how many tracks passes through each pixel.

This works the way I want it to(except it's quite slow).

What i want is to add a function to my model, now it creates one combined raster from every input GPX file, but in addition I want it to do the same just only for each month.

every polyline feature has an attribute field called "Month" with values 1-12 after which month it was created.

Here is the model so far(simplified, the full one is in attached thumbnails):

[ATTACH=CONFIG]32799[/ATTACH] [ATTACH=CONFIG]32800[/ATTACH]

I'm thinking that the last par of the model, from "Polyline to Raster" and out, needs to be copied for each month, and with some type of "select by attributes" I can manage to create rasters from specific months.

the problem is that I don't know how to select the polylines by attributes and get them in to a new string on the model.

this is kind of what I think it might look like:
[ATTACH=CONFIG]32801[/ATTACH]

the first part of the model is the same as above, attached one string for February and one for January, and its this select by attributes step i need help with.

anyone? Thanks for your time!
0 Kudos
1 Solution

Accepted Solutions
DuncanHornby
MVP Notable Contributor
Einar,

I think the easiest way to help you here is to create a  dummy scenario which you can explore and try and understand. To this end I have uploaded a dummy toolbox with a model calling a sub-model so you can understand how they link and what inline substitution is.

Duncan

View solution in original post

0 Kudos
5 Replies
DuncanHornby
MVP Notable Contributor
Einar,

Your images are unreadable, can you upload better quality images so we can read your model?

Duncan
0 Kudos
by Anonymous User
Not applicable
Original User: edorheim

Einar,

Your images are unreadable, can you upload better quality images so we can read your model?

Duncan


Sorry about that! tried to fix it now, had to split the model into two pictures, but it should be fine now!
Thanks for letting me know.
0 Kudos
DuncanHornby
MVP Notable Contributor
Einar,

Are you familiar with the concept of a sub-model? It is literally nothing more than you dragging a pre-built model into another model when in model builder.

You can only have 1 iterator in a model so you you cannot create a loop within a loop by sticking 2 iterators in 1 model. The solution to this is to put the second iterator and the connected logic in its own  "sub" model and then drag the sub model into the master model and connect it up.

To pass outputs of a tool into the sub model you must set the inputs of sub model as parameters (right click on them and set as parameter so you get that "P").

Hopefully you understand above? Well if it were me I would create a master model with your logic up to your "field to build raster calc". As I understand that is a polyline featureclass with a month field?

Now create new new model which has a feature selection iterator as it start with the case field being your month and chain the logic of polyline to raster to cell statistics. You would then use inline substitution to give your final output a unique name, in your case based upon month ID.

You then drag this model into the master model and connect it up.

Duncan
0 Kudos
by Anonymous User
Not applicable
Original User: edorheim

Einar,

Are you familiar with the concept of a sub-model? It is literally nothing more than you dragging a pre-built model into another model when in model builder.

You can only have 1 iterator in a model so you you cannot create a loop within a loop by sticking 2 iterators in 1 model. The solution to this is to put the second iterator and the connected logic in its own  "sub" model and then drag the sub model into the master model and connect it up.

To pass outputs of a tool into the sub model you must set the inputs of sub model as parameters (right click on them and set as parameter so you get that "P").

Hopefully you understand above? Well if it were me I would create a master model with your logic up to your "field to build raster calc". As I understand that is a polyline featureclass with a month field?

Now create new new model which has a feature selection iterator as it start with the case field being your month and chain the logic of polyline to raster to cell statistics. You would then use inline substitution to give your final output a unique name, in your case based upon month ID.

You then drag this model into the master model and connect it up.

Duncan


never tried model in a model, but understand the concept i think. from the part you call master model the output is several polyline feature classes, one for each GPX-file in the input for the Iterate files.
I tried to divide it in to two models, but still i don't see how i get it to choose only files with specific attribute values..
what is this "case field? and inline substitution?

this is the attribute tables of my outputs from the "master model":
[ATTACH=CONFIG]32834[/ATTACH]

as you probably have figured out I'm quite new to this model builder concept, so I really appreciate your help!

Einar
0 Kudos
DuncanHornby
MVP Notable Contributor
Einar,

I think the easiest way to help you here is to create a  dummy scenario which you can explore and try and understand. To this end I have uploaded a dummy toolbox with a model calling a sub-model so you can understand how they link and what inline substitution is.

Duncan
0 Kudos