[MUSIC] Hello everyone and welcome back. In this lecture, we're going to continue where we left off last time with the big model we're building, to determine which side of the river specific parcels are on, and whether they're on the same side of the river as an original town boundary. So where we left off last time, we had been using the copy features, and field, and calculate field tool in order to add a default field on our parcels layer that says whether or not it's a river. And it fills that with zeros out, saying none of these parcels are rivers. So let's continue on with that and actually make that a real value and by that I mean let's find which parcels actually are the river and fill the is river filled with value one where parcels is a river. So to do that though, we need to do a little bit of a work around. Well I want to be able to use selections just like by location the parcels that are in line with the river, I can't do that with just a feature class. The feature class only exist in my disk and that's what we're using right now as we're using feature classes. So instead, what I need to do is make a feature layer. Now, a feature layer is a lot like what we're seeing here in our table of contents. It's a feature because that's loaded into memory and has some properties related to it and can be used in an analysis such as a selection workflow. Now, this one might already be a feature layer but if I want to be able to provide the correct parameters to people, in the future when they run this tool, the copy features tool can take feature classes as input. So I need to make it a feature layer just to make sure. So, let's actually move this back over here and let's go search for the make feature layer tool. And once again I can drag and drop on the canvas and I'm going to connect that last parcels layer here to make feature layer tool as the input features. And in this case, I'm just going to name it parcels layer, call it okay and let's make the output layer called parcels layer as well. That's what we're going to reference in the future, is this parcel's layer will be the name basically of our feature class but of our feature layer that we use when we're working within other tools. Okay, and now that we have a feature layer, we can actually run selections on it. So again, we're going to look at another tool that we've used in the interface but that we have yet to use in geoprocessing, which is the select layer by location tool. Or otherwise known as select by location when we've used it in the selection, select by location menu. And when I double click it, again it looks a little different but all the same options are there. I can have my layer being selected, the selecting features, I can have a relationship type like we're used to, a search distance and the selection type whether it's new or either adding to existing selection or what. So, let's cancel that for a moment and we're going to just provide this as the Input Feature Layer. And then, to get the other one from now, let's right click on it and do Make Variable, From Parameter and then Selecting Features. So I want to show the Selecting Features on the canvas without having specified it yet, maybe I don't actually have it defined yet, or what, but I haven't maybe loaded it up. And what I can do now, after I've made it a variable so it shows up in my canvas, is I can right click and make it a model parameter and I can do the same for the parcels layer, so that in the future when this is run, both of these can be provided as parameters to a geoprocessing tool. And I could have done this another way, I could have dragged the rivers layer onto the canvas and the connected it just like we did before. But I wanted to make sure you knew all the different ways to get these variables to show up on your model canvas here. And now I can double click it and I can select the major rivers layer in my tool here. And I'll rename it and call it rivers and I'll rename this and call it parcels, so that should anybody use it in the future, that's what's going to show up when they run the geoprocessing tool. So if I save it and go take a look at our tool here, double click it, I see rivers and parcels, okay. So now we provided two inputs to this tool from our geoprocessing workflow. We provided the parcels layer and the rivers layer and it says it's ready to run but let's make sure we've set all the options. So in order to find the parcels that have a river running to them, I'm going to select the parcels layer using intersect relationship, where intersects with the rivers layer. That looks good to me, a new selection is fine and I click OK. And let's once again do auto layout and we're getting a very linear model here for the most part. And notice that our label is way up here now, so it's just moving around, we'll correct it at the end. Okay, and now that we have our river parcels selected, we can override the default that we set in this calculate value step by setting the selected parcels to have the value of one. So I click Control+C and copy that tool and result here. So that one thing we can do on a model builder canvas too, we don't have to cancel and go back to search, we can just copy tools and re-run them, it linked it there for me but without even moving it, I can say what I want this selected layer to be the Input Table, in this case. And then I need to make sure I go correct the values in here, so I'll double click on it to open it up. And we'll calculate the value for is_river, and in this case we're going to set it to one. So we've selected the parcels that intersect with the river and then we're now going to calculate those selected parcel values for the is_river field and say, yes, they are rivers and make that value of that field to one. So again, let's auto layout and since this is all pretty opaque, since we're doing it on the model builder canvas, let's use the power of model builder and make sure we're doing it right and run our model as it is now, even though it's not finished. And so I'll save it and let's just run it piece wise here, so I could validate it up here, make sure everything's good and then run it. But let's just run piece by piece so I'm going to right click on the copy features tool and run it and it runs over here. And it's completed, I got the shadow, cool. And then let's run the Add Field tool, and that completed as well. And then we can watch this. So let's right click here and go to Add To Display, and so we now have a new copy of this data here, parcels with river field, just as we had it named. And I can open the attribute table and let's go find is_river field and it's null everywhere. Okay, so now let's run the calculate default river value. Sorry, these keep appearing off screen, so it ran and now I can close it. And let's just do a quick sort on this layer here and that updated the values. So we ran the tool here and I just did a sort to force it to refresh the values in the field, so we can see that is_river is now zero here and now let's make it a feature layer. So I did and it runs very quickly. And now it's not necessarily working with this version here, so I can add this to display, so I have parcels layer now which is different from parcels with river field even though the values in the attribute table will update. But if I want to see the selections in action, I need to go to parcels layer so, let's remove the previous version we're looking at and let's run, Select By Location now. So Select By Location ran, I'll close it and let's minimize Modelbuilder, sorry it minimized off screen, soit usually minimizes just kind of behind the application here. Okay so select by location ran and now if I just update my display by going View, Refresh or if I zoom in and zoom out, I can see this selection again. So it doesn't automatically update the display in ArcMap after we run an operation model builder, but if we force the display to refresh we can see what we are doing here. So yeah, it's selecting what I want correctly, selected all the parcels that intersect with the river, and now we can calculate the value of those parcels. Since, remember, field calculator only works on selected features. So I ran that and it finished and I will close it and now let's go take a look at parcels layer's attribute table. And these are all zero, which is to be expected, but they're not selected parcels right now. So the ones that are selected still should be one, so that's perfect. Everything is selected on here and the selected attribute table should have been updated to a one saying yeah, it's a river parcel and everything else is a zero saying no, not a river parcel. Okay, so our workflow works so far, we have successfully built a model a very complicated model, so far that figures out which parcels have a river running through them. Which we can use as a jumping off point for the rest of our model. We'll leave it there for now, but in the next video we will continue where we left off and we'll go on and dissolve the parcels based upon that river value, since the ones that aren't river can be joined in one big polygon. And then we will do the rest of our selection and attribute updates. Okay, see you there.