Leah Saunders shows how to use ModelBuilder to create, edit, and run model tools.
00:01 All right. So, welcome to Getting Started with ModelBuilder.
00:04 My name is Leah Saunders and I work for Esri.
00:08 I am a solution engineer out of our Seattle, Washington office, and been with the company for just over…
00:15 …10 years, doing all sorts of things, so…
00:18 But, I always seem to come back to the conference and end up doing something with geoprocessing…
00:24 …and ModelBuilder and working in the Spatial Analysis Island.
00:27 I think that's maybe where my heart is; I'm not sure.
00:32 So, how many of you are new this year to the conference? First time?
00:36 Wow, good. I'd would like to kind of check it out and see; hopefully, you're enjoying it and getting lots of information.
00:43 So, the next 75 minutes, we're going to be sort of talking about ModelBuilder.
00:48 How to get started, and what you can do with it.
00:51 And then after, if you, you know, want more information, there's additional sessions…
00:57 …and then you can always come down to the Spatial Analysis Island and we have a bunch of ModelBuilder…
01:01 …and geoprocessing experts down there so come and hit us up for some more information.
01:09 So, the agenda for the next little while, while you're here with me, we're going to go over the basics of geoprocessing.
01:15 What is it?
01:17 And then we'll get into ModelBuilder itself, how to create some model tools…
01:21 …and then a few tips for designing and sharing your model.
01:25 And I'll have some additional resources at the end, just to kind of get you going once you step out of this room and…
01:31 …you know, you're actually going to be start to work with it.
01:37 So a basic geoprocessing overview.
01:40 What is geoprocessing?
01:43 So how many of you, when you hear geoprocessing, think buffers and clips and unions…
01:47 …and traditional sort of GIS, geoprocessing tools, right?
01:52 So, I mean, that's where I come from.
01:55 But, over the years we've kind of expanded this definition to mean more like a system for managing…
02:00 …and manipulating any kind of spatial data, maybe tabular data relating to spatial issues.
02:07 So, we're able to solve real-world problems, or real-world spatial problems with this, and model our processes…
02:15 …and systems and things like that, and then, you know, we generally have a lot of questions…
02:19 …and that's why we're doing this stuff.
02:21 So we want to get results and we can use the geoprocessing sort of environment to do that.
02:28 So, the geoprocessing language itself is really kind of sitting in tools.
02:33 So we have many different toolboxes with toolsets and tools, like these specific functions or multiple functions.
02:41 Here we have your individual tools - Clip tool, Raster Calculator, and so on.
02:46 Lots of different tools.
02:47 And you get different tools with extensions, different tools with different levels of ArcGIS Desktop.
02:55 So that's really our geoprocessing language, is working with these tools themselves.
03:02 Now, the geoprocessing framework is sort of these different environments that we can use these tools in…
03:10 …that we can kind of work in.
03:11 So you can open up the tool itself and explicitly put in the parameters and click OK and away you go.
03:18 Or, what we're going to be looking at this afternoon is pulling these tools to create sort of a process in ModelBuilder. Okay.
03:28 We also have the Python window, so if you're using ArcGIS 10 we added this window so that…
03:33 …you can quickly type in Python commands, right?
03:36 And use the tools in there.
03:38 You can also take that one step further and go into a scripting environment, right?
03:42 So you can write more than just one sort of geoprocessing command or tool.
03:49 Write an entire script to do all of that work.
03:51 So these four pieces, the tools in ModelBuilder, Python window, and the scripting environment…
03:57 …all sort of are what we use in the geoprocessing framework, ok?
04:01 Or, what we refer to as the framework itself.
04:06 Finding tools.
04:07 So you've probably noticed by now I'm working in ArcGIS 10, by these screen shots.
04:13 So we added a few different things at 10 so that you can actually search for tools.
04:18 Maybe versions before that you like to go to your ArcToolbox and go find some tools in there.
04:25 Well, we've added a geoprocessing menu at 10 so that you can get some of the very common tools…
04:30 …buffer tools, clip tools, things like that - things that you may use quite often.
04:36 We also have the Catalog window, and in the Catalog window you can access all of the toolboxes.
04:42 The system toolboxes, as well as any custom toolboxes that you create.
04:47 And then the one thing that I really have become very accustomed to using and really enjoy now is the Search window.
04:56 So the Search window allows you to search for not only tools, but also maps and data…
05:00 …by little keywords.
05:03 So, I'll show you an example of, you know, not just looking for a clip tool by its name…
05:07 …but we can also use alternative names or descriptive names when we're searching for tools.
05:16 On our geoprocessing menu, we do have some geoprocessing options as well.
05:22 So I kind of put this in the beginning, so that way you'll have an idea of where to get some of this information…
05:27 …as you start to use the geoprocessing framework.
05:31 So, on the geoprocessing options, a couple of important things that I want to point out.
05:35 One is the ability to overwrite the outputs of operations.
05:39 So, that's the check box at the very top of the dialog, and this allows you to go ahead and overwrite…
05:45 …output to previous geoprocessing operations.
05:49 The real use of this is, if you have to run a model or a tool multiple times when you're testing things…
05:56 …you may not want to go and have to clean it up.
05:57 You may just want to overwrite and move on, right?
06:00 So you can go ahead and do that.
06:01 I definitely recommend logging in geoprocessing operations to a log file.
06:06 If you call tech support and you have a problem with geoprocessing, and they may ask you, do you have a log file for this?
06:13 It's really beneficial for you to log your processes as well as to give the tech support or other people…
06:23 …supporting you on this.
06:25 ModelBuilder has specifically one individual option that I'll go over a little later on…
06:31 …that has to do connecting pieces in ModelBuilder.
06:34 Also, you may want to check out the results management options, so you, when you run geoprocessing tools…
06:40 …you get these results, and then you can go ahead and decide how long you want to keep those results.
06:45 Okay, so the default is two weeks, but you can go beyond that, a month, two months, or you can say…
06:52 …I only want to keep it for the day. Okay.
06:55 So, it's up to you how you want to do that.
06:58 All right, there's a few other little options at the bottom.
07:00 So definitely go and check out the geoprocessing options on the geoprocessing menu on ArcMap or ArcCatalog.
07:10 All right, so let's take a look at this.
07:16 So here I just have a map of Jefferson County in Kentucky, and, a very simple map, but I'm going to go ahead…
07:26 …and kind of ignore some of this stuff and just give you the overview of how to find some tools in ArcGIS.
07:34 So one of the first things I talked about was this geoprocessing menu, and so you can find…
07:39 …you know, six of our most common sort of geoprocessing tools, and we also have the ability to get to our…
07:45 …geoprocessing options dialog on that drop-down, 'kay.
07:50 Something else that we can do is open up the Catalog window.
07:54 So this is a nice little window inside of ArcMap and I can get to all my toolboxes inside this window.
08:00 All right, so you have system toolboxes and then your custom toolboxes.
08:04 No search capability here, so you have to know where you're going.
08:07 So, if I'm going to look for my buffer I need to know that it's in the Proximity toolset, okay?
08:13 However, if you're not too sure where a tool is, you want to be able to search and you can use…
08:19 …the new search window in ArcGIS 10.
08:22 So, as I said, it takes not only the name of the tool - so if I know it's called clip, I just don't know where it is…
08:28 …I can type in Clip and have it go and search, 'kay.
08:33 But if I'm relatively new to the software and new to GIS, I may not know that it's called Clip, right?
08:38 I just know that this is a cookie cutter type of function. 'Kay.
08:42 So, I can actually type in cookie and get the Clip tool.
08:47 So there's been some intelligence built into this search, to be able to search through the description…
08:53 …and other information that's put with the tool, so that way, you know, you can search by common names…
08:59 …by things that are a little more descriptive as opposed to just the actual full name in there.
09:04 So I think this is pretty neat, right?
09:08 All right, so that's how we can sort of get started with geoprocessing and searching for tools.
09:17 So, the basis for my demonstration today in that Kentucky map is because I need to solve a problem.
09:25 I tend to focus a lot on public safety in my region, so this is kind of near and dear to my heart.
09:32 We have a scenario here where we need to prioritize the schools in the area for emergency shelter planning.
09:39 We tend to use these tools as our shelters in cases of emergency, because they have larger areas and rooms…
09:46 …that we can kind of put people.
09:47 However, we do have a lot of schools in the area that are in what we could call vulnerable areas.
09:55 So these vulnerable areas could be within 2,600 feet of the Hazmat route, right?
10:02 Within 2,600 feet of a hazardous facility, and also within a flood hazard area.
10:11 Okay, so we have some flooding potential there.
10:13 So these three items here, I need to make sure that these schools are far enough away from these…
10:19 …that they can be used for emergency shelters. Okay.
10:24 So this is our scenario for today and this is really what we're going to be working on throughout…
10:28 …the rest of the workshop, and creating a model to find these potential schools for our shelters.
10:36 I just wanted to kind of give you an overview of what that looks like.
10:48 We have four specific tools in here.
10:49 And, just to give you an idea of the final model okay - so this is what our final model is - there's a few different things.
10:50 One is to buffer our Hazmat routes.
10:53 Another is to buffer our hazardous facilities.
10:56 And then we're going to overlay those two outputs and union them with the flooding areas…
11:03 …and that will give us our vulnerable areas within the county.
11:09 And then I want to go and find all the schools that are not within those vulnerable areas.
11:14 So, I'm going to use the Erase tool to do that, and then my output is going to be the schools…
11:18 …that I could use as potential shelters. Okay?
11:21 So that's the process that we're going to go through when we go ahead and build the actual model.
11:26 Okay, and this is essentially what we're going to be looking at later on.
11:29 But I like to give you an overview of the model first, and then we can start to put all the pieces together, right?
11:34 And build it from scratch, so that you don't think I'm pulling some smoke and mirrors there when I work through there, right?
11:42 All right.
11:45 So getting started with ModelBuilder itself.
11:49 Why would you want to use ModelBuilder, right?
11:51 You can go and open up a buffer tool and run it.
11:54 You can open up the same buffer tool again and run it on some different data.
11:58 You have the ability to open up all these tools and run them and put a little bit of intelligence into them…
12:06 …but there's some distinct advantages of using ModelBuilder.
12:12 One is, it's a way of encapsulating workflows, right?
12:15 Making reusable and sharable processes.
12:19 If you went to the plenary session on Monday you may have seen Lauren Rosenshein…
12:26 …doing something with spatial statistics and showing a new 10.1 tool.
12:30 She created a model and she was able to go and share that model for methodology to somebody in Denver…
12:36 …and then he was able to go ahead and reuse that model and apply it to his own data, right?
12:40 So she did all of this work, why not be able to share that and rerun that?
12:45 So, that's a sort of a reason why we want to use ModelBuilder - automating and managing workflows.
12:53 Running a complex succession of processes in one tool.
12:57 I may have 15 tools that I have to run, and I have to do that once a month. Right.
13:02 I have to remember, then, the succession of those tools, right?
13:06 Why not put it into a model, and then have the software kind of do the work for me, right?
13:11 Write it once, run it as many times as I want to.
13:16 Another reason is that you can actually go and create a model and then sort of change little things…
13:22 …to match what you need to do when you run it the next time.
13:25 So if I need to add another tool, or I need to change a parameter, you can kind of do that…
13:30 …very easily, once you have the base model.
13:34 And then lastly, being able to have a visual representation of your work. Okay?
13:39 Again, back to Monday, you know, when Lauren did the spatial statistics, she showed that she created a report…
13:47 …and the methodology of how she got the results that she did.
13:50 And in that report she actually put in the image of the model. Okay.
13:54 So, a nice graphical way of showing your methodology and what you went through to get…
13:59 …the results that you did, all right.
14:00 So a lot of times people ask us, what did you go through to do that?
14:04 We have to kind of justify some of our processes there.
14:10 So before we really get started on ModelBuilder, I need to kind of point out something in ArcGIS…
14:17 …and that is the types of toolboxes that you have available to you.
14:22 One is the system toolboxes.
14:24 So these are the toolboxes that are installed with the software, right?
14:27 They are read-only toolboxes.
14:29 You cannot go and add additional pieces to them.
14:32 This read only is really a good thing, because this is the stuff that gets installed with the software…
14:38 …and you want it to be running all the time, or working for you all the time.
14:42 So, if we were to give you the ability to mess around with them a little bit, we might give you the potential…
14:47 …to mess up those toolboxes, okay?
14:49 So, the toolboxes that you get to go and play with and add new tools to, and whatever else you want…
14:56 …are the custom toolboxes.
14:58 So these are your user-created toolboxes.
15:01 They're stored either in a folder as a .tbx file, or inside of a geodatabase.
15:06 And that can even be an enterprise geodatabase, if you choose.
15:10 So keep the actual toolbox with your data, or you can kind of put it aside.
15:17 So why am I telling you this?
15:19 Well, when we make models, we are making our own new tools, and we need a toolbox to put those models in…
15:26 …and that would be our own custom toolbox.
15:28 So a couple of different ways to start a brand new model - one is to go and click on the ModelBuilder…
15:34 …button on the ArcMap standard toolbar.
15:37 It looks like a little icon that you're seeing on the left side of the slide.
15:41 So, this opens up a brand new ModelBuilder window, and then you can go and create a model and save that from there.
15:47 The other way to do this is to go into a custom toolbox, right-click, and choose New Model.
15:53 That again opens up your ModelBuilder window, and now you can go and start to work on your model, okay?
16:02 So, the first thing I like to do when I go and create a new model is actually go to the Model Properties…
16:07 …and open that up, and start to set up my properties, right?
16:11 So I create my name, which cannot have spaces, okay.
16:16 The label, however, is what actually appears in a toolbox, and that can have spaces.
16:22 But make it nice and descriptive, right?
16:24 So that if you're looking at it later on and you give this toolbox to somebody, they can see…
16:29 …basically by the name what it might do.
16:32 In addition to that, it's always a good practice to go ahead and put in a description.
16:37 Put in as much of the description as you possibly can.
16:41 That's definitely helpful when sharing models.
16:44 And then the other option towards the bottom of the Model Properties General tab is Relative Paths.
16:51 So hopefully you're kind of familiar with Relative Paths in map documents, right?
16:55 So if I open up a map document and I have it on my E drive and I save that, and I save it with Relative Paths…
17:03 …somebody else can open it up on a D drive and it won't necessarily break the data.
17:08 And this is the same for models; models use data and use tools, so they do carry paths…
17:13 …around with them for that information.
17:18 So another thing that I like to go over before we start to actually create a model is the idea of…
17:25 …environments and environment settings.
17:27 So these are sort of default settings that you can have that go with your tools or in your applications…
17:35 …such as workspaces - whether it's a scratch workspace or a current workspace that your data's coming from.
17:42 You can also set up an environment setting for a coordinate system. Okay.
17:49 So if you usually work in one particular coordinate system, then you can set that up as sort of…
17:54 …your default coordinate system, right?
17:57 It's important to know sort of the hierarchy of how environment settings are distributed.
18:03 So, at the very top, in number 1 here, we have the application settings.
18:09 So, these environment settings or defaults are set at the application level.
18:13 That would be ArcMap or ArcCatalog.
18:15 Then, any tool that is run within that application, actually inherits those applications settings.
18:23 However, they can be override.
18:25 So if you set in ArcMap that your coordinate system is going to be some particular area…
18:31 …in the United States, state plain, say I'm in Oregon, but then I need to run a tool…
18:37 …that's going to run some data on Washington.
18:39 I can actually go and open up that tool and override that Oregon setting, in that tool just for that time that I'm running it, okay.
18:48 That's the same for models.
18:50 So models themselves have environment settings on them, okay?
18:55 But then the actual model processes, the tools that are inside ModelBuilder, you can override the model settings with those.
19:04 So I'll kind of show you what this looks like.
19:09 All right. Let's go ahead and start to make a model.
19:14 So what I'm going to do is go ahead and create my own brand new toolbox.
19:19 So we have tools here, and I'm going to right-click, and say New Toolbox.
19:27 UC 2011.
19:29 All right. So there's my brand new toolbox, and I'm going to go ahead and right-click on that say…
19:35 …New Model, and now I have a brand new model.
19:38 So the first thing I would like to do, as I said, is go to the actual model properties.
19:45 So we can go to the General tab and I'm going to give this a name.
19:51 All right.
19:52 Remember, names can't have spaces, but what I am going to do is go ahead…
19:57 …and make the label basically the same, just add a space in there, right, make it simple.
20:02 And I can add a description, model to find possible school shelters.
20:14 All right.
20:15 Obviously, if I had more time I'd probably put in more of a description than that.
20:19 And I'm going to show a relative path, because I may go and give this to somebody else…
20:22 …at a neighboring county who might want to run the same sort of analysis.
20:28 We have some additional tabs here which I'll cover a little later on to the parameters.
20:33 So what I'm going to do next though is go and look at my environment settings.
20:37 So these environment settings are on the model settings themselves, right?
20:42 And I'm going to choose which settings I want to set.
20:45 So in this case I'm looking at the work space settings, and I'm going to go and grab my current and scratch.
20:51 Let me set values.
20:54 And here I have my current workspace and scratch workspace.
20:57 Now notice they're already filled in.
21:00 This model has inherited the application settings, so in the actual application I set up to grab my data…
21:08 …from the model data .gdb, and to use a scratch .gdb workspace as my scratch workspace.
21:16 So I'm just going to leave those, because that's ok for my model.
21:19 If I wanted to overwrite it I would just go ahead and change these values in here.
21:25 All right.
21:28 So now we have our vulnerability model; again, it's looking at the label here.
21:32 And we could go ahead and start to build our actual process.
21:37 So just to give you a quick review of what we looked at for the model that we're going to be building…
21:42 …again, I need to create a couple buffers on my hazardous facilities and my HAZMAT route…
21:48 …and then I'm going to go and use a union tool to pull all that, all those hazardous…
21:52 …or vulnerable areas together, and then I'm going to go ahead and have the software find the schools…
21:58 …that are not inside of those vulnerable areas.
22:02 So we'll go back in here to ModelBuilder and I'm going to go and start to build.
22:08 So I can find tools and add tools in a few different ways.
22:12 If I know where the tools are, what toolboxes, I can go ahead and just find those.
22:16 Right here on my System tools, system toolbox, and I can go to my analysis and proximity and there's my buffer tool.
22:26 So I can just drag and drop onto this environment.
22:29 I also have the ability to go and hit the Add Data or Tool, and go and drag the tool from there, as well.
22:34 Lots of different options.
22:36 So then I'm going to fill in the information.
22:38 And again, I can go and drag and drop data on here.
22:41 So I can say I want my hazardous facilities on here, and then I can go ahead and use our…
22:46 …Connector tool to connect these pieces together.
22:49 Okay, and these are going to be my input features.
22:51 Now, the only colored-in oval here is my blue oval and that's my input data.
22:59 These other pieces of my model, or model elements, are clear because this tool is not ready to run…
23:06 …so I need to go in and put in some additional parameters into the buffer tool.
23:09 So I can open up the buffer tool, set my output feature class, so this is going to be my buffer has facilities…
23:24 …hit save, and I can put in my distance.
23:29 I'm going to put 2,600 feet; and then I can also change some of the optional parameters here.
23:35 The tool only requires you to put in the required parameters in order to be ready to run.
23:42 So the Optional are just that; they're optional.
23:44 You don't have to fill them in, in order to make the tool ready, right?
23:48 So now I have the buffer tool that's ready to run.
23:51 Okay, everything's filled in nicely.
23:53 I can go ahead and change some additional things, so I can rename this to…let's say…Hazardous Facility Buffer.
24:08 It's always good to put as much information into these models as possible, so that way if you have to share it…
24:13 …or you leave your job and you leave behind this information, somebody else can quickly look at it…
24:18 …and kind of get an idea of what it does, right?
24:20 That's important.
24:22 Right, so we need to add another buffer tool because I need to buffer my Hazmat route.
24:27 So I'm going to go ahead and search for it, just so you can see how Search works in here again.
24:33 So we're going to do Buffer, and then we can go and drag and drop from the search onto my ModelBuilder canvas.
24:42 I have some tools on the toolbar here that allow me to sort of lay out my model, and…
24:48 …I can use the auto layout to have it kind of look nice.
24:52 And then what I'm going to do in this buffer is double-click on it and fill in the information.
24:56 So I want to now buffer my Hazmat routes, and I want to create an output for those…
25:02 …so we're going to do Buffer Hazmat routes.
25:11 And again I'm going to buffer by 2,600 feet and again I'm just going to dissolve these buffers. Okay.
25:18 So now you'll see my other buffer tool is ready to run as well.
25:22 And again, I can go ahead and change some of the graphic-looking information on here.
25:27 So, we'll say, this is my Hazmat routes buffer.
25:33 All right.
25:35 Okay, so far so good. Right?
25:37 Just added a couple of tools. Okay.
25:41 So the next thing we want to do is go ahead and add the Union tool, so I'm going ahead and search.
25:46 I don't necessarily know where that is.
25:53 Okay. So we can go and grab our Union tool, and add this again to our ModelBuilder session here.
26:01 And, what I need to do now is to go in and connect these two outputs to the Union tool…
26:08 …and grab the flood areas to union, as well.
26:12 So I can use my Connection tool again, and just draw a line and just draw another line.
26:19 You'll notice I get a drop-down box here.
26:21 I'll show you in a few minutes how to get that so that way you can determine if it's an input…
26:26 …or you know what type of parameter it is that I'm filling in here.
26:32 And then I'm going to go ahead and grab my flooding areas.
26:37 Okay. Put those on there, and connect that as well as an input. Okay.
26:45 Now we can start to see how things are all connecting together.
26:48 Again, the Union fill is not ready to run at this point; I need to go in and fill in some other information.
26:53 It grabs my input for me, so that's great.
26:56 And then I'm just going to go and set my output, and leave all of the rest of the options. Okay.
27:03 So it's always a good thing to validate your models.
27:06 We have a nice little tool here that says Validate entire model, so we can click that…
27:11 …and what it does is it checks to make sure that everything's connected okay, that I have my inputs…
27:16 …that you can access so I can see them, that all of my parameters are filled in correctly, and so on.
27:24 It's kind of a nice little way of just checking our tool.
27:28 What is it doing here? I don't know why it's doing that.
27:32 All right. There we go. I'm going to go ahead and rename this to vulnerable areas. And that's my output.
27:42 So. I'm going to go ahead and save this model.
27:45 And what I want to do is add this final output to my display, and I'm having some weird behavior here.
27:54 I don't know if it's my mouse or what.
27:58 Okay. So let's go ahead and just run this and see what happens.
28:02 So cross your fingers, hope that everything works ok.
28:03 …and you'll actually add that to the display System Run if it's been run.
28:05 We hit Run.
28:06 You'll notice as I'm running the tool things start to turn red, and get highlighted, and then…
28:13 …as these tools run, they actually get a little drop-down shadow behind them, saying that they've been run already.
28:20 So, when they turn red that's the tool that's actually being run, and then when they get this drop-down…
28:26 …that means that the tool is in an already run state.
28:30 Okay. So it's already been run.
28:32 So now what I can do is go ahead and add that to my display. Okay.
28:39 And there's the result of running those three tools. Okay.
28:44 So you have a nice little option in ModelBuilder to add things to your display.
28:50 It's just by checking off Add to display.
28:53 Now, the nice thing about this too is that the ModelBuilder window actually does talk to the map.
28:58 So if I forgot to do this before running the model I can go and right click on it and add to display…
29:06 Or if I turn it off, it's gone again. Okay, kind of neat, right? It all works together. Okay.
29:14 So I've run three tools.
29:15 What I'm gonna do is actually go and validate this model so that I can set it backwards to a ready-to-run state, right?
29:23 So I can run it again.
29:25 It's ready to go again.
29:34 Now, before I do that I'm going to go ahead and add that one last tool that I need in here, and that's the Erase tool.
29:43 …going to remove them from my results and just give me the schools that are not overlaying those vulnerable areas.
29:51 So we can go ahead and connect this to our Erase, and this is going to be my actual Erase features…
30:01 …and then what I need to do is grab again my schools, and put these on here and then…
30:07 …link those up as my inputs.
30:11 So we'll open up the Erase, and we need an output, and this is going to be my potential school shelters.
30:17 I'm just going to override that, and then hit Ok.
30:21 All right.
30:23 So now I'm going to make sure that this adds to the display at the end, and maybe a quick rename…
30:31 …of this, so potential shelters. Okay.
30:38 And I want to do something else additional, so you notice if you run a tool by default it just kind of…
30:43 …gives you whatever symbology it feels like, right?
30:46 The software chooses something, way back in the day you'd always see brown, it's always some brown colors.
30:51 Now, who knows?
30:53 Somebody has some fun with color palettes.
30:56 But what we can do on this is we can build some sort of intelligence into this actual output, and use a layer file.
31:04 You know, those LYR files that we have? We've had them around for a few years?
31:08 We can go and use the symbology from the layer file that exists on disk and apply that symbology to my output.
31:15 So I don't have to make the extra step once the tool's run to go and symbolize it.
31:20 The software will actually do it for me.
31:23 So what we can do is go and… Get into our layers here, and nonvulnerable schools, and now hit Ok.
31:36 So now what I can do is just go ahead and save this and we will just check to make sure everything's…
31:41 …ok and we're going to run this tool.
31:46 All right, so it's doing a buffer of the Hazmat route, working through the union of the hazardous possible areas…
31:58 …and it went into the Erase and away we go.
32:02 And those are my schools that are left over.
32:04 So, just so that you believe me, we'll turn on the Hazmat routes, and we'll turn on the hazardous facilities…
32:12 …and the flooding hazards.
32:14 And if I go zoom into an area here.
32:19 All right. So now you can see all the schools that are left over.
32:22 Okay. Pretty neat. Good stuff, right?
32:27 And we just did that all on the fly, in just a few minutes.
32:31 So, pretty quick to get going with ModelBuilder.
32:36 A lot of extra options, but what I'm going to do right now is go back into the slides…
32:40 …and then we can get into the extra options and putting in a little more fun into our models.
32:47 So, I'm going to kind of fly through these slides because we've already discussed this and kind of seen what it is.
32:54 So the model elements, you have tools and variables and connectors that you have possibly on your actual model.
33:05 Adding tools and data to the model; you saw me drag and drop, okay.
33:10 We can also use the Add Data or Tool in the ModelBuilder window to go ahead and add information.
33:16 So it's pretty easy to get stuff onto that nice drag-and-drop environment.
33:23 A couple different ways to connect elements - I use the connector tool a few times to go and…
33:28 …connect the data to the actual tools.
33:31 But you can also go and double-click the tool and open it up and fill in all the parameters…
33:36 …just like you would if you were to go ahead and open up the tool outside of the model.
33:40 And it'll go in and connect all the items together and pull data in if it's not on there.
33:48 You have a couple of different types of little ovals on your model, so you'll see the existing data are the blue ovals…
33:55 …so these are the things that I already had in my map or it's sitting on disk and I can go and drag them in.
34:01 And then on the other side you have the derived data, so this is the data that's going to be output…
34:06 …right, and these are the green ovals on the model.
34:13 So, in terms of the tools and parameters, you have inputs and outputs and then a few other possibilities…
34:19 …so in the Buffer tool we also have a distance that we need to fill in.
34:23 As I said, you only have to fill in the required parameters on a tool in order to get that tool to run, or be ready to run.
34:31 If you choose to fill in the optional that's entirely up to you, but they will not affect…
34:36 …whether or not that tool is ready to run.
34:40 And just a tip in terms of connecting.
34:43 Back on the Geoprocessing Options dialog that I showed you a little earlier on, you have an option in sort of…
34:49 …the middle of the dialog for ModelBuilder and if you check that off, what happens when you connect…
34:56 …your data elements, your little blue ovals to the tools is it will give you that drop-down box that you saw…
35:04 …and it'll allow you to determine what that piece that's being connected is going to be used for in the model.
35:11 So if you're connecting data to a buffer tool, you're probably using it as input features…
35:19 …but there are some tools, like the clip tool, that take both an input and a clip, right?
35:25 So you get the option on the fly very quickly as to whether or not that input data set is going to be…
35:30 …the clip data set or the input feature, okay?
35:35 So a nice little way of quickly going through things, rather than having to open up the dialog for the tool afterwards…
35:40 …and checking to make sure everything is ok in there.
35:45 The model states, if it is…if a model tool and any of the ovals are clear or white, that means they're not ready to run.
35:55 So if you try and run the model, nothing is going to happen.
35:59 What you do need to have is a ready-to-run state where everything is filled in and nice and colored…
36:06 …and then you can go ahead and run your model.
36:09 If it has been run you get the drop shadow.
36:12 If you saw that, I had a drop shadow once I ran some of those tools.
36:24 And that brings us to the validating here.
36:26 And then if you want to reset that you can go ahead and validate the model and reset the model to a ready-to-run state.
36:27 So if you validate and there's success, it'll return a model from has been run to a ready-to-run state.
36:35 If it's unsuccessful, then certain pieces of the model may be white, right?
36:40 So they're not ready to run, so you need to go and figure out what the possible problem is.
36:44 It may be the geodatabase that you were trying to write to doesn't exist, lots of different possibilities there.
36:50 It's always important to validate your model, especially if you're getting it from somebody.
36:54 So if you get a model, don't just take it at face value that it's ready to go, right?
36:58 Just because it looks like it might be ready to go doesn't mean that it necessarily is, okay…
37:04 …so definitely use the Validate for that.
37:10 Now, creating model tools.
37:11 So we've created a model, we open it up in ModelBuilder and we can go ahead and just hit the little Play button…
37:18 …and it runs the model for us, right?
37:21 Well, all models are essentially tools.
37:25 They're a tool in the toolbox.
37:27 They just have a little different icon and they may be a workflow of multiple tools.
37:34 So, if you've ever received a model or created a model and double-clicked on it in Toolbox and you get this dialog…
37:41 …with nothing in it, right?
37:42 It says, this tool has no parameters? Okay.
37:45 That means that nothing is built into the model that you need to fill in.
37:49 You can just hit OK and the model runs, right?
37:54 However, you can change that and actually go and make a model so that it has parameters that you can fill in on the fly.
38:01 So if you have Buffer in your model you may want to change the distance, you know.
38:07 Today I might run it on 2,600 feet tomorrow I might run it on 3,000 feet or 1,000 feet.
38:12 I don't want to have to go into the model itself, open it all up, find that little parameter in the buffer tool and change that.
38:18 I can expose that to a dialog, to a tool dialog, okay?
38:23 So that's a difference that we're seeing on the screen here.
38:27 We have one tool on the left-hand side that has absolutely no parameters in it.
38:32 I don't have to fill in anything, I can just hit OK.
38:34 The one on the right side, we actually have to fill in some information because they've exposed those pieces…
38:40 …of that model to a dialog for me, and I'll show you how to do that.
38:47 So, if you ever look at a model and you see the little P beside pieces of the model, that's the parameter.
38:54 It means that this item or element in the model is actually a parameter in that model…
38:59 …so when you double-click on it and open up that dialog you're going to see something there…
39:03 …that you need to fill in, okay?
39:05 It is important, too, to watch out because if you create something as a parameter in your model…
39:12 …the name that is on that oval or that element is actually going to be the name that's used…
39:18 …in the dialog, okay, so we want to make that something descriptive.
39:22 That's why I was renaming some of those items.
39:28 You can also go and create variables from actual parameters inside of a tool.
39:34 So, ModelBuilder will allow you to go and create variables for inputs, right?
39:39 So, whether that's the distance on a buffer or that's a workspace, or a geodatabase location…
39:46 …or a folder that you're going to output your datasets to.
39:49 So all you need to do is go and right-click on the actual tool.
39:52 With the Buffer tool I can go right-click on it and make variable from parameters and choose distance…
39:58 …or whatever other parameters are in there.
39:59 And I'll show you how to do that.
40:05 Let's go ahead and make a model tool.
40:10 You guys are all very quiet.
40:13 Hopefully lunch isn't making you fall asleep, or I'm not incredibly boring.
40:18 All right. So we're back in our vulnerability model here and I'm going to go ahead and actually make a tool out of this.
40:25 So a few things that I may want to do.
40:27 I have a buffer of my Hazmat routes.
40:31 What I can do here is right-click on that tool, make a variable from a parameter.
40:36 And look, I have all the different sort of possible parameters inside of my tool.
40:41 So I'm going to actually go and check off Distance here, and you'll notice on my model it makes this little extra element.
40:49 Okay, that's a variable element.
40:50 That's a light blue color.
40:52 And, right now, open that up, and I currently have sort of a default in there set to 2,600 feet.
41:02 So what I'm going to do is make this a model parameter, now you see the little P beside it.
41:07 And I can go ahead and rename this, so this is going to be my buffer distance.
41:13 Okay, so we'll just expand this out a little bit so we can see it.
41:17 All right. So I save this, and if I go back into my toolbox here, and I double-click on this model, it exposes that as a parameter.
41:29 So now I can, on the fly, very quickly, go ahead and change that buffer distance.
41:33 I don't have to go back into the actual model interface every time and do that, right?
41:38 And notice it took on the name that I have in there, buffer distance.
41:41 That's what I named the element as.
41:43 So, a few different options there.
41:46 You can also go ahead and make output model parameters, okay.
41:52 So I'm going to check this off as a model parameter, and here I have the little P. Okay.
41:58 So we'll save that one and I'll show you, again, now I have an additional parameter, okay.
42:06 My potential shelters and notice it has the output, right?
42:09 So I call them potential school shelters in my scratch geodatabase.
42:13 Now the nice thing about this is you want to sort of modify this dialog a little bit.
42:17 We can go into the properties of this model and go to that Parameters tab that I skipped over at the beginning? 'Kay.
42:24 So here's the name of those parameters.
42:27 Maybe I want to go ahead and move these, so I can change this one, the buffer distance down to the bottom.
42:33 The type, whether it's required or optional.
42:36 If it is a parameter from a tool, like distance, that's a required parameter in order to run the buffer tool.
42:43 I can't go and change that in this dialog.
42:46 Okay, it's going to be required in order to run this tool.
42:50 So I hit OK, and now if I double-click on it, now you can see that my potential shelters…
42:55 …are now at the top and then my buffer distance.
42:58 So a nice way of making a tool.
43:00 Something else that was added at ArcGIS 10 is the ability to then go ahead and take that…
43:05 …pull it sort of out of the toolbox itself and put it on a toolbar.
43:11 So I can go and open up my Customize dialog box where I can find all these fun commands…
43:16 …that won't fit on toolbars all the time.
43:19 And I can go to my geoprocessing tools, and I can go ahead and add the tool.
43:26 So here we have our tools, and my vulnerability model, and then I can go and drag and drop that.
43:36 All right. I can change some information so if I want, maybe, just the name of it, I can change the name.
43:43 Let's do text only.
43:45 Hit Close, and now I can run that tool just from a toolbar.
43:51 Kind of nice.
43:52 And you can do that pretty much with all of your geoprocessing tools; scripts, and thinks like that, too.
43:57 I thought that was kind of fun because, you know, I don't want to have to find it in the toolbox all the time, right.
44:08 All right. Some tips for designing and sharing your models.
44:13 Intermediate data.
44:15 So, what happens to all that data that gets generated on these little intermediate steps to get to your final results?
44:23 So I ran a model with two buffers and a union, and then I have an Erase tool, right?
44:30 That Erase tool is really going to generate the result that I want.
44:33 Those buffers and unions, though, that's just some intermediate processing to get to that.
44:38 I don't necessarily want to keep around that intermediate data, right?
44:42 It's kind of junk to me.
44:44 So I may run it, you know, dump it into a scratch workspace, but then I probably have to go and clean that up.
44:49 Well, ModelBuilder, by default, sets those intermediate pieces to intermediate data. Okay.
44:57 They do that by default.
44:58 So that way you kind of can go and clean that up very easily at the end.
45:04 The final output never gets set to intermediate data, though. Okay.
45:08 So that's a good thing because in case you forget to turn off that default, at least you'll have your final output, right?
45:15 You may be screaming at the software because you don't have the intermediate, but that's ok.
45:19 All right. Couple things about this, though.
45:23 If you're in the ModelBuilder window, the actual dialog, and working in the model there…
45:27 …and then run it from there, the intermediate data does not get automatically deleted.
45:33 You have to go up to the model menu and explicitly click Delete Intermediate Data, okay?
45:40 If you run the model as a tool - I double-click on the model and you have intermediate dataset…
45:47 …the tool will actually go and clean up the intermediate data on its own after.
45:53 You don't have to do the additional step.
45:54 So. The story here is, make sure that you have only the appropriate things that you want to be deleted…
46:01 …set as your intermediate data, right?
46:04 Because maybe I do want all those extra intermediate results, all those little buffers and unions that I do there.
46:14 So here's some tips for managing that intermediate data.
46:17 Couple don'ts.
46:18 Do not write your intermediate data to an SDE geodatabase, an enterprise geodatabase…
46:25 …because every time you want to go and delete that, it has to go back out to the enterprise geodatabase to do it.
46:31 Okay. You may not have permissions to delete stuff in that geodatabase.
46:35 Right? That's going to cause some problems.
46:39 Remote data. Do not put it in a really, like in a remote dataset or on a network drive somewhere; trying to set stuff local.
46:49 Okay, your final result can go out to something that's remote, but try and keep the intermediate stuff local…
46:54 …because if you're cleaning it up, it's a lot easier to clean it up locally on your machine…
46:59 …rather than having to go and hit an external drive from there.
47:03 Don't clutter your permanent results database.
47:06 So, if you have a permanent database and you're trying to write your results to that…
47:11 …don't clutter it up with all this intermediate stuff.
47:13 Put that stuff in a scratch database, right?
47:17 You have the ability to make these file geodatabases, you know, whatever you want, generally.
47:23 So why not create a scratch geodatabase that you dump all of your intermediate work in, right?
47:28 I was just really, really bad back in the days with my shapefile one, shapefile two, shapefile three…
47:35 …and they're all in a junk folder and a year later I finally looked at that junk folder.
47:39 Couldn't figure out if anything was even useful.
47:43 So, try not to clutter up your workspaces.
47:47 Okay. So use the scratch.
47:51 All right. The other new thing you can do here is you can take models that you create and embed them in other models.
47:58 Okay, so nesting models.
48:00 The really nice thing about this is that if you have an extremely complex model, right?
48:06 You're running 20 different tools.
48:08 You can actually break that model up into smaller pieces and have certain pieces run.
48:14 So for example, if I take in a bunch of CAD data, and you convert that to a geodatabase…
48:18 …and I'm going to run some other processes, I may want to go and have the conversion as its own model…
48:23 …and then some other additional processes as a separate model, and pull them altogether into a…
48:29 …third sort of overall, this is my tool.
48:34 So it's really easy to do this.
48:36 You can do this at any point with any type of model tool that you have, script tools, things like that.
48:43 And it's also nice if you have to collaborate with a bunch of people and you're individually working on different pieces.
48:52 Some tips for running models. Running models from ModelBuilder.
48:57 As I said, intermediate data is not automatically deleted, so you need to go and actually do this on your own.
49:03 The Add to Display - when you go and right-click on Output, and you say Add to Display, it adds that to the map, okay?
49:14 No background geoprocessing here.
49:16 So we have the ability to turn on and off a background geoprocessing.
49:20 I don't know if many of you've heard of this, but if you have a pretty complex process and you need to run it…
49:28 …for a few hours but you don't want it to interrupt what you're doing in ArcMap or ArcCatalog…
49:33 …you can run it in the background, and then you'll get a little pop-up at the bottom of your screen telling you…
49:38 …that hey, this model ran, and it will give you a check box if it went ok or an x if it went really bad.
49:44 However, if you're running the actual tool inside the ModelBuilder window it will not run in the background at all.
49:51 It always runs in the foreground on the screen, okay?
49:54 If you're running it as a tool the intermediate data is automatically deleted so again…
49:59 …make sure that you only have that option set for the actual intermediate pieces that you don't want later on, okay.
50:00 …if you have to go and share your models and distribute them; okay.
50:03 Make sure your layout looks decent.
50:08 Another sort of trick, when you Add to Display and you're running as a tool, that element…
50:14 …that output element that you have, you need to not only check off the Add to Display…
50:19 …but you also need to make that output model parameter.
50:23 It has to have the little P beside it, okay.
50:26 Then you can double-click on the tool and run it and it'll add to the display for you.
50:30 So one extra little piece that you need to do there.
50:33 And then you do have the option to run things in the foreground, okay, or the background if you're running it as a tool.
50:39 So it's up to you.
50:43 Definitely design your models to be sharable.
50:45 Okay, so make them pretty flexible, maybe not as data dependent if you're going to be sharing them.
50:52 Set environment settings, relative paths, and so on.
50:55 There is a really good read about tips for distributing models; I recommend reading that…
51:05 You can also add some additional pieces to your layout.
51:08 You can add labels on items so to give some more clarity as to what those things are doing.
51:13 And then, new at 10, we have this item descriptions that were added, kind of like a metadata.
51:19 You can go and add item descriptions to your models, right?
51:23 And then also create help documentation.
51:27 In terms of modifying the layout, you have a lot of different options there to sort of move things around.
51:32 It does not affect the order that tools run in, right?
51:36 They'll still run in the order that you have them all connected, even if they're all over the place in terms of your layout, okay.
51:44 And you have a couple different modes here with your layouts.
51:47 You can go ahead and have an automatic, so if I click that little blue and green button that we're seeing here…
51:54 …it will automatically go and lay out my tools for me.
51:58 Or I can have a manual mode where I actually determine how everything is going to be laid out.
52:05 And there are some options for that, so if you go to the diagram properties in the model, you have options…
52:11 …whether you orient them from left to right, right to left, center, whatever you want to do with them.
52:17 Okay. And this is all for layout; it does not affect how the model actually runs itself.
52:22 In documenting, 'cause I said you can make labels; you can make some free floating labels if you want.
52:28 If you're floatin' around, maybe a title, something like that.
52:31 You can make some element labels.
52:33 So, if you want to put a little label beside one of the elements in the model to describe things.
52:40 You can also create labels on connectors, so those little connector lines that you see…
52:43 …right, you can make some labels on those as well.
52:46 This is all really good practice for documenting your model, right?
52:51 If you're just going to use the model as your own little process that you run you probably don't have to do all of this.
52:57 But I recommend doing it, you know, just down the road if you have a few minutes…
53:00 …just so that if you have to go on vacation or leave your job, at least somebody has something to work with.
53:07 Another neat thing is you may have seen on my first model that instead of just having…
53:11 …little ovals, I have little images, right?
53:14 Little JPEGs in there.
53:16 So you can go and change these elements to what we call a picture element, and you can go and choose…
53:22 …a JPEG or a GIFF or something like that, and sort of create a little snapshot of maybe what that data looks like.
53:31 All right. Just to show you really quick, let's go ahead and open up our model.
53:38 How are we doing for time here?
53:40 Fifteen minutes, right?
53:42 All right. So, I can do a few things here if I wanted to go ahead and change this to a picture symbol.
53:49 And I can go and find…see, there's my junk. I still have a junk folder.
53:57 All right. So we can go into our…let's see here…I know I did that on my Hazmat route, so I have a little JPEG, right?
54:10 And then I can go ahead and change the size of that if I want.
54:13 They do lots of things in there.
54:15 I can also create little labels.
54:18 I create a label and go and change the…what's in here; display properties.
54:32 And we can go and change the font and all sorts of things.
54:37 You can create labels on connectors, too, so if I highlight a little connector and do Create a Label…
54:43 …it'll create a label next to my connector.
54:45 Just nice little ways of sort of documenting.
54:48 And as I said, you can also go ahead and go to the model properties and put in some help information in here as well.
54:55 So you can generate a little help file.
54:57 And you can also give the model some additional descriptive information.
55:07 All right. Learning more.
55:10 So since you've been so quiet, we might actually end it early which means you can probably come up and ask questions.
55:15 ArcGIS Online. Okay.
55:17 So, through the Resource Center you can get to the help very easily.
55:23 You can get to, if you're still working in 9.3 or a previous version there is that help online…
55:28 …or you can go to the 10 version help.
55:30 I recommend going to the online help as your sort of first location, because the help that comes with the software…
55:38 …doesn't get updated as often, right?
55:41 It gets updated when you install things like Service Packs and stuff like that.
55:45 The online help is always going to be a little more up to date.
55:50 The Geoprocessing Resource Center.
55:52 If you haven't gone here and you have to do geoprocessing, you have to create scripts, you have to create models…
55:59 …go to the Geoprocessing Resource Center, and just because I love it and I want to show it to you…
56:09 We'll go to resources.arcgis.com, scroll down to the bottom and hit the geoprocessing, okay…
56:17 …and here's your Geoprocessing Resource Center.
56:20 So lots of stuff you can find in here.
56:23 There's presentations that you can get access to.
56:26 There's a model and script tool gallery.
56:29 Really neat things in here, okay.
56:30 I'm learning more and more because I only come here once a year and I get to go and then sit…
56:34 …with all the development people and know what they've put up there and they put really fantastic things up there. Okay.
56:41 You can go and add your stuff to this, too.
56:43 If you've made a really neat model and you want to share it because you worked so hard on it…
56:48 …and you think it'd be useful to other people, you can go and add to this resource center as well.
56:54 You can also go the Forums directly through here.
56:56 There's a geoprocessing blog. Okay.
56:59 So go and check this out.
57:00 If you do anything else in ArcGIS, if you're part of a sort of a community, you do local government…
57:06 …or you do water utilities, the resource center is your friend.
57:09 The best place to go to get a lot of information very quickly.
57:16 And no I don't get paid to just plug the Resource Center.
57:20 I just actually really do love it.
57:22 All right. So getting more at the conference, okay we're here Wednesday, so I guess that first one is a new point.
57:30 But Building Tools with ModelBuilder, okay, we had a session this morning and there's going…
57:33 …to be another one tomorrow afternoon.
57:36 That is the Advanced ModelBuilder session, if you want something quick and dirty.
57:41 It gives you a lot of additional pieces; building actual tools and really building on what I did this afternoon.
57:48 And then also come to this Spatial Analysis Showcase.
57:51 We have a lot of really good people there to help you out and, you know, show you how to build models…
57:57 …if you have specific questions on problems that you want to solve.
58:01 Also, if you just have tools that you want to learn a little more about, definitely come down there.
58:06 Okay, and we can handle all sorts of questions from all over the place.
58:10 Couple of other things.
58:11 Instructor-led training. Okay. We do have a few courses that cover ModelBuilder in little pieces.
58:17 There's also some live seminars and recordings.
58:19 There's a free one, I think it's 60 minutes, on building models in ModelBuilder.
58:25 And then there's a new book that just came out, Getting to Know ArcGIS ModelBuilder.
58:30 I believe it is down in the Spatial Outlet, so you can go and check it out there.
58:34 It is your introduction to advanced model building.
58:38 I think this is the first book that we've actually had that is all about ModelBuilder.
58:43 Okay. So, I would go and check it out.
58:45 I haven't really looked at the book too much but I've heard some really good things about it…
58:49 …and I met the author yesterday morning; he's wandering around.
58:53 So, definitely go and check that out if you need some really good resources for ModelBuilder.
58:58 And before you leave, take down this web address.
59:03 You want to go to the Esri page, and go to the Session Evals, in order to evaluate this session that I presented today.
59:12 And that includes me. I am always open to feedback, and also just what you want to see in…
59:17 …sessions and whether it was useful.
59:20 All right. So have a wonderful afternoon and enjoy the rest of your conference.
© Esri 2013 http://www.esri.com