Model Builder - Iterators Two - Iterate Feature Selection

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone this is the second video in a series about how to use iterators in model builder if you remember from the first video we looked at iterators in their kind of classes here and I define them as classes by this gray bar an arc and it's ever you know present quest to be helpful when it can has used to demarcate the different classes and and we did one example from this bottom area here because what all of these share in common is they iterate through a bunch of files alright so what we're using these for is if you have 10 20 30 50 a thousand whatever different shape files and you need to run the same process for each of them this is how you'd accomplish that next video a little bit more nuanced about what we're gonna do with this one is actually show how would you iterate through individual component parts of a feature right you know I think this goes back way to the early videos about data structure and type you know but but if we look at something like let me see what the best example might be here a little too many buddy I will look at crime like we look back at each crime you know we often think in aggregate that this is showing you know a bunch of crime for Philadelphia when you think about it what this shape file actually is what this feature class actually is is composed of twenty five hundred and eighty two individual parts right and each part in this instance represents a single crime and that single crime has any number of attributes describing it when it happened what happened where it's located a flag if it's one of these things a shortened version of its name the dispatch time the date and what iterate feature selection which is what we're gonna use an example with right now iterate feature selection what that essentially allows you to do is one of two things it almost just emulates what it's like to use the select by attribute tool and if you remember select by attribute or selected any kind whenever a subset is selected any process that you do to that file will only work for that subset I'm sure we've all been here in our frustrated moments when we're trying to buffer a hundred natives and for some reason only three keep buffering over and over again and we look at the attribute table we learn oh it's because they're selected this tool and model builder isn't trying to accomplish just that right our muscle memory is built to remember how we do it here right in desktop but what if you wanted to emulate that same process imagine there's an invisible hand that goes hello fi d6 I will run a process for you hello fi d-32 I will run a process for you now you now you know you know you now you so on until the end even better what if we wanted to do that same thing but maybe break it down by similar values that's what we're gonna do in this example you might want to come and say short type why don't I go you know each one iteratively first I'll do something to all the assaults then I'll do something to all of the burglaries I had so on and so forth so it's just allowing you to kind of emulate what you do with selection and I this is gonna be a theme I'm sure you've heard in all of the videos that are detailing model builder model builders not reinventing the wheel in some areas I mean there there are certain places where they're certainly making work flows easier like iterating and there are tools when you start getting into the videos on model only tools that are unique to model builder but for the most part it's just a new interface to accomplish the same types of workflow that you're used to doing because of your muscle memory in arc that's what feature selection is it's just emulating allowing you to select by attribute and then run a process for each attribute but to do it automatically or it's emulating that process where you'd go through one at a time and do something different to each feature part so the example that I'm going to give here you know that I have we have something called crime sample here and you know we invented this little field a short type shows a salty burglary so on and so forth and I want to run through and I want to calculate a density for each and then compare the densities similar to how we did in the first video with months I want to do it now you know by a field type and you know normally if I were doing this outside a model builder I would just kind of keep going up here and maybe go to select by attribute all right assaults your turn first or burglary will start with you because you're there all right I got 25 758 burglaries come up to my toolbox get my density out drag it in blah blah blah and then repeat the process for all of the different values we're trying to build that into a really quick and easy workflow so that you could essentially just do this look what I do here oh I must have had burglaries selected that's my bad didn't think through that one let's try that again yeah there we go and assaults in burglaries and homicides and notice anyone who's watching this also put a way to make the output use a standard symbology so when it comes back to you we can actually you know interestingly enough right compare them all cuz the symbology will will be equal oh dear arc arc be an arc right just a ways that we can look at the symbologies and compare the different symbologies yadda yadda yadda all right so let's build this one all right so any time you want to do an iterator your first step right always you want to right click or through the add tool go to iterators they were in this area now these will accomplish the same things that this will iterate through rows in the table this will iterate through shapefile all right so always want to click an iterator to see what it needs is input a little bit different here but the primary thing that's going to need is hey what do you want me to iterate through share I want you to iterate through the crime sample and then this is the real critical element and I know there's a tendency when you use tools to just rush through the tool and think that it's gonna do what you want it to do right you want it to iterate through the crime types but you've told it nothing so if you just run this tool right now what it would actually try to do would be to go through every single one of the 2500 records one I know you I know you and so and so and so and so and so on and that is okay sometimes sometimes you might actually want to do that all right maybe you want to compare a bunch of Euclidean or cost distances to each other or maybe you want to iteratively cite you know 10 or 15 locations for future bikes their stations and then merge them together at the end so you'll want to go one at a time that's totally fine but what we want to do and what I showed is we want to go by groupings right and that grouping is organized by a field value here so while it is perfectly fine depending on your workflow to leave this as is we want to just group we're simply saying hey look for similar values in the field name short type and group by that alright those who are coming into this video right now may want to rewatch the first video because we do a nice conversation about these three now which are critical to understanding iterators but let's remind ourselves now this is the input right the input for feature selection is the feature show me the feature that I'm gonna break into component parts and run through this is each component part that's gonna come out so if you were iterating one at a time right if you didn't pick anything in the field values it would go fi d6 then it would go F ID 32 and so on because we picked short type as our field it will go assaults and burglaries and so on and so forth last time this was named value or name now it's named value what this is essentially gonna store or for you is whatever groups your fields so if you pick nothing first this would store six because that's what's getting iterated through then it would be 32 that's a funny funny little quote you guys are gonna get there in the video from my partner who's upstairs yes it sounds like I'm having a very intense conversation down here well let's just let that one stay up that'll be the interesting addition to this video alright so right you can go through one at a time and it would take on that value six thirty two fifty three sixty to seventy 107 so on and so forth because we chose short type it's gonna go through assaults then burglaries right then robbed and that's what its gonna store there that's the purpose of a container it stores something when we iterated through the features that stored their name now that we're iterating through records it's storming some identifiers so we can connect back to that record right in the whole point of this is so if we're gonna iterate through the the short types here all right if we're gonna iterate through all features or feature parts rather that have the same value for assault and then burglary in the homicide then rape and robbery and theft we're gonna want to be able to know and use the fact that hey this one where these were assaults let's use that name so we can save it so we're not overwriting our processes at the end all right so what we want to do we want to do density so we can go up here and drag in density and connect to and fro play with our little attributes here right we're saying you know we want you to be maybe fifteen hundred two thousand whatever you want to do if you remember what I did previously I added some variables from environments here I'm saying hey make your processing extent identical you know to the major thing crime sample just making sure that you know our processing extent and our cell sizes are identical to make sure that the raster is aligned with each other did you okay nope you will be 25 feet all right so now the processes are set up all right I theoretically could go in here and just try to save this as maybe I'll save this as output or you know you know tight bends and as we discussed previously if I were to run it would work but it wouldn't give me what I wanted so we don't go through crime sample it's gonna break it down by short type right because I asked it to and it'll start with the assaults and it'll store the word AS SLT here and it'll pass all of the assaults into kernel density and then they'll save itself as type dense and then it'll move on and go to burglaries because that's the next value it'll save the word burg here it'll go on it'll do a kernel density of burg and it'll store itself as uh-oh type dense right so if you remember from the previous video this is your Savior this is iteratively storing a s SL T then burg right then Rob then hummus whatever value it's taking from short and we want to just be able to use that using a process called inline variable substitution all right so simply by mimicking the name that we see of the container and putting parentheses around or sorry percents around it we're saying hey for each iteration whatever's being stored here in value just take that take what's being stored here so start by taking a SLT then take burg and so on and so forth all right so now we can save it if you want to make sure they all have the same output like I did previously you can actually control that in your output you know right click and go to properties and you know actually pick a layer is one I made previously now you just pick that one and everyone will take it on I go to model and run and there will go one at a time I foolishly forgot to right-click and hit add to display if I had done this properly each one would be adding one at a time to the display and we would have gotten to see the cool effect of each of the time so just Steph's gonna add but if I find where I saved them I can see there they are all of the ones that I saved by their individual part
Info
Channel: Shea O'Neill
Views: 19,780
Rating: 4.9540229 out of 5
Keywords:
Id: SDlfwZVNz_g
Channel Id: undefined
Length: 13min 46sec (826 seconds)
Published: Sun Mar 06 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.