00:01All right. So, welcome to Getting Started with ModelBuilder.
00:04My name is Leah Saunders and I work for Esri.
00:08I 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:18But, 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:27I think that's maybe where my heart is; I'm not sure.
00:32So, how many of you are new this year to the conference? First time?
00:36Wow, good. I'd would like to kind of check it out and see; hopefully, you're enjoying it and getting lots of information.
00:43So, the next 75 minutes, we're going to be sort of talking about ModelBuilder.
00:48How to get started, and what you can do with it.
00:51And 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:09So, the agenda for the next little while, while you're here with me, we're going to go over the basics of geoprocessing.
01:15What is it?
01:17And 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:25And 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:37So a basic geoprocessing overview.
01:40What is geoprocessing?
01:43So 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:52So, I mean, that's where I come from.
01:55But, 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:07So, 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:21So we want to get results and we can use the geoprocessing sort of environment to do that.
02:28So, the geoprocessing language itself is really kind of sitting in tools.
02:33So we have many different toolboxes with toolsets and tools, like these specific functions or multiple functions.
02:41Here we have your individual tools - Clip tool, Raster Calculator, and so on.
02:46Lots of different tools.
02:47And you get different tools with extensions, different tools with different levels of ArcGIS Desktop.
02:55So that's really our geoprocessing language, is working with these tools themselves.
03:02Now, 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:11So you can open up the tool itself and explicitly put in the parameters and click OK and away you go.
03:18Or, what we're going to be looking at this afternoon is pulling these tools to create sort of a process in ModelBuilder. Okay.
03:28We 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:36And use the tools in there.
03:38You can also take that one step further and go into a scripting environment, right?
03:42So you can write more than just one sort of geoprocessing command or tool.
03:49Write an entire script to do all of that work.
03:51So 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:01Or, what we refer to as the framework itself.
04:07So you've probably noticed by now I'm working in ArcGIS 10, by these screen shots.
04:13So we added a few different things at 10 so that you can actually search for tools.
04:18Maybe versions before that you like to go to your ArcToolbox and go find some tools in there.
04:25Well, 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:36We also have the Catalog window, and in the Catalog window you can access all of the toolboxes.
04:42The system toolboxes, as well as any custom toolboxes that you create.
04:47And then the one thing that I really have become very accustomed to using and really enjoy now is the Search window.
04:56So the Search window allows you to search for not only tools, but also maps and data…
05:00…by little keywords.
05:03So, 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:16On our geoprocessing menu, we do have some geoprocessing options as well.
05:22So 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:31So, on the geoprocessing options, a couple of important things that I want to point out.
05:35One is the ability to overwrite the outputs of operations.
05:39So, 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:49The 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:57You may just want to overwrite and move on, right?
06:00So you can go ahead and do that.
06:01I definitely recommend logging in geoprocessing operations to a log file.
06:06If 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:13It'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:25ModelBuilder 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:34Also, 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:45Okay, 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:55So, it's up to you how you want to do that.
06:58All right, there's a few other little options at the bottom.
07:00So definitely go and check out the geoprocessing options on the geoprocessing menu on ArcMap or ArcCatalog.
07:10All right, so let's take a look at this.
07:16So 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:34So 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:50Something else that we can do is open up the Catalog window.
07:54So this is a nice little window inside of ArcMap and I can get to all my toolboxes inside this window.
08:00All right, so you have system toolboxes and then your custom toolboxes.
08:04No search capability here, so you have to know where you're going.
08:07So, if I'm going to look for my buffer I need to know that it's in the Proximity toolset, okay?
08:13However, 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:22So, 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:33But if I'm relatively new to the software and new to GIS, I may not know that it's called Clip, right?
08:38I just know that this is a cookie cutter type of function. 'Kay.
08:42So, I can actually type in cookie and get the Clip tool.
08:47So 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:04So I think this is pretty neat, right?
09:08All right, so that's how we can sort of get started with geoprocessing and searching for tools.
09:17So, the basis for my demonstration today in that Kentucky map is because I need to solve a problem.
09:25I tend to focus a lot on public safety in my region, so this is kind of near and dear to my heart.
09:32We have a scenario here where we need to prioritize the schools in the area for emergency shelter planning.
09:39We 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:47However, we do have a lot of schools in the area that are in what we could call vulnerable areas.
09:55So these vulnerable areas could be within 2,600 feet of the Hazmat route, right?
10:02Within 2,600 feet of a hazardous facility, and also within a flood hazard area.
10:11Okay, so we have some flooding potential there.
10:13So 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:24So 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:36I just wanted to kind of give you an overview of what that looks like.
10:48We have four specific tools in here.
10:49And, 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:50One is to buffer our Hazmat routes.
10:53Another is to buffer our hazardous facilities.
10:56And 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:09And then I want to go and find all the schools that are not within those vulnerable areas.
11:14So, 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:21So that's the process that we're going to go through when we go ahead and build the actual model.
11:26Okay, and this is essentially what we're going to be looking at later on.
11:29But I like to give you an overview of the model first, and then we can start to put all the pieces together, right?
11:34And 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:45So getting started with ModelBuilder itself.
11:49Why would you want to use ModelBuilder, right?
11:51You can go and open up a buffer tool and run it.
11:54You can open up the same buffer tool again and run it on some different data.
11:58You 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:12One is, it's a way of encapsulating workflows, right?
12:15Making reusable and sharable processes.
12:19If 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:30She 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:40So she did all of this work, why not be able to share that and rerun that?
12:45So, that's a sort of a reason why we want to use ModelBuilder - automating and managing workflows.
12:53Running a complex succession of processes in one tool.
12:57I may have 15 tools that I have to run, and I have to do that once a month. Right.
13:02I have to remember, then, the succession of those tools, right?
13:06Why not put it into a model, and then have the software kind of do the work for me, right?
13:11Write it once, run it as many times as I want to.
13:16Another 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:25So 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:34And then lastly, being able to have a visual representation of your work. Okay?
13:39Again, 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:50And in that report she actually put in the image of the model. Okay.
13:54So, 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:00So a lot of times people ask us, what did you go through to do that?
14:04We have to kind of justify some of our processes there.
14:10So 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:22One is the system toolboxes.
14:24So these are the toolboxes that are installed with the software, right?
14:27They are read-only toolboxes.
14:29You cannot go and add additional pieces to them.
14:32This 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:42So, 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:49So, 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:58So these are your user-created toolboxes.
15:01They're stored either in a folder as a .tbx file, or inside of a geodatabase.
15:06And that can even be an enterprise geodatabase, if you choose.
15:10So keep the actual toolbox with your data, or you can kind of put it aside.
15:17So why am I telling you this?
15:19Well, 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:28So 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:37It looks like a little icon that you're seeing on the left side of the slide.
15:41So, this opens up a brand new ModelBuilder window, and then you can go and create a model and save that from there.
15:47The other way to do this is to go into a custom toolbox, right-click, and choose New Model.
15:53That again opens up your ModelBuilder window, and now you can go and start to work on your model, okay?
16:02So, 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:11So I create my name, which cannot have spaces, okay.
16:16The label, however, is what actually appears in a toolbox, and that can have spaces.
16:22But make it nice and descriptive, right?
16:24So 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:32In addition to that, it's always a good practice to go ahead and put in a description.
16:37Put in as much of the description as you possibly can.
16:41That's definitely helpful when sharing models.
16:44And then the other option towards the bottom of the Model Properties General tab is Relative Paths.
16:51So hopefully you're kind of familiar with Relative Paths in map documents, right?
16:55So 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:08And 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:18So 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:27So 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:42You can also set up an environment setting for a coordinate system. Okay.
17:49So 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:57It's important to know sort of the hierarchy of how environment settings are distributed.
18:03So, at the very top, in number 1 here, we have the application settings.
18:09So, these environment settings or defaults are set at the application level.
18:13That would be ArcMap or ArcCatalog.
18:15Then, any tool that is run within that application, actually inherits those applications settings.
18:23However, they can be override.
18:25So 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:39I 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:48That's the same for models.
18:50So models themselves have environment settings on them, okay?
18:55But then the actual model processes, the tools that are inside ModelBuilder, you can override the model settings with those.
19:04So I'll kind of show you what this looks like.
19:09All right. Let's go ahead and start to make a model.
19:14So what I'm going to do is go ahead and create my own brand new toolbox.
19:19So we have tools here, and I'm going to right-click, and say New Toolbox.
19:29All 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:38So the first thing I would like to do, as I said, is go to the actual model properties.
19:45So we can go to the General tab and I'm going to give this a name.
19:52Remember, 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:02And I can add a description, model to find possible school shelters.
20:15Obviously, if I had more time I'd probably put in more of a description than that.
20:19And 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:28We have some additional tabs here which I'll cover a little later on to the parameters.
20:33So what I'm going to do next though is go and look at my environment settings.
20:37So these environment settings are on the model settings themselves, right?
20:42And I'm going to choose which settings I want to set.
20:45So in this case I'm looking at the work space settings, and I'm going to go and grab my current and scratch.
20:51Let me set values.
20:54And here I have my current workspace and scratch workspace.
20:57Now notice they're already filled in.
21:00This 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:16So I'm just going to leave those, because that's ok for my model.
21:19If I wanted to overwrite it I would just go ahead and change these values in here.
21:28So now we have our vulnerability model; again, it's looking at the label here.
21:32And we could go ahead and start to build our actual process.
21:37So 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:02So we'll go back in here to ModelBuilder and I'm going to go and start to build.
22:08So I can find tools and add tools in a few different ways.
22:12If I know where the tools are, what toolboxes, I can go ahead and just find those.
22:16Right here on my System tools, system toolbox, and I can go to my analysis and proximity and there's my buffer tool.
22:26So I can just drag and drop onto this environment.
22:29I also have the ability to go and hit the Add Data or Tool, and go and drag the tool from there, as well.
22:34Lots of different options.
22:36So then I'm going to fill in the information.
22:38And again, I can go and drag and drop data on here.
22:41So 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:49Okay, and these are going to be my input features.
22:51Now, the only colored-in oval here is my blue oval and that's my input data.
22:59These 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:09So 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:29I'm going to put 2,600 feet; and then I can also change some of the optional parameters here.
23:35The tool only requires you to put in the required parameters in order to be ready to run.
23:42So the Optional are just that; they're optional.
23:44You don't have to fill them in, in order to make the tool ready, right?
23:48So now I have the buffer tool that's ready to run.
23:51Okay, everything's filled in nicely.
23:53I can go ahead and change some additional things, so I can rename this to…let's say…Hazardous Facility Buffer.
24:08It'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:22Right, so we need to add another buffer tool because I need to buffer my Hazmat route.
24:27So I'm going to go ahead and search for it, just so you can see how Search works in here again.
24:33So we're going to do Buffer, and then we can go and drag and drop from the search onto my ModelBuilder canvas.
24:42I 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:52And then what I'm going to do in this buffer is double-click on it and fill in the information.
24:56So 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:11And again I'm going to buffer by 2,600 feet and again I'm just going to dissolve these buffers. Okay.
25:18So now you'll see my other buffer tool is ready to run as well.
25:22And again, I can go ahead and change some of the graphic-looking information on here.
25:27So, we'll say, this is my Hazmat routes buffer.
25:35Okay, so far so good. Right?
25:37Just added a couple of tools. Okay.
25:41So the next thing we want to do is go ahead and add the Union tool, so I'm going ahead and search.
25:46I don't necessarily know where that is.
25:53Okay. So we can go and grab our Union tool, and add this again to our ModelBuilder session here.
26:01And, 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:12So I can use my Connection tool again, and just draw a line and just draw another line.
26:19You'll notice I get a drop-down box here.
26:21I'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:32And then I'm going to go ahead and grab my flooding areas.
26:37Okay. Put those on there, and connect that as well as an input. Okay.
26:45Now we can start to see how things are all connecting together.
26:48Again, the Union fill is not ready to run at this point; I need to go in and fill in some other information.
26:53It grabs my input for me, so that's great.
26:56And then I'm just going to go and set my output, and leave all of the rest of the options. Okay.
27:03So it's always a good thing to validate your models.
27:06We 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:24It's kind of a nice little way of just checking our tool.
27:28What is it doing here? I don't know why it's doing that.
27:32All right. There we go. I'm going to go ahead and rename this to vulnerable areas. And that's my output.
27:42So. I'm going to go ahead and save this model.
27:45And what I want to do is add this final output to my display, and I'm having some weird behavior here.
27:54I don't know if it's my mouse or what.
27:58Okay. So let's go ahead and just run this and see what happens.
28:02So 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:05We hit Run.
28:06You'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:20So, 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:30Okay. So it's already been run.
28:32So now what I can do is go ahead and add that to my display. Okay.
28:39And there's the result of running those three tools. Okay.
28:44So you have a nice little option in ModelBuilder to add things to your display.
28:50It's just by checking off Add to display.
28:53Now, the nice thing about this too is that the ModelBuilder window actually does talk to the map.
28:58So if I forgot to do this before running the model I can go and right click on it and add to display…
29:06Or if I turn it off, it's gone again. Okay, kind of neat, right? It all works together. Okay.
29:14So I've run three tools.
29:15What 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:23So I can run it again.
29:25It's ready to go again.
29:34Now, 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:51So 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:11So we'll open up the Erase, and we need an output, and this is going to be my potential school shelters.
30:17I'm just going to override that, and then hit Ok.
30:23So 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:38And 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:46The software chooses something, way back in the day you'd always see brown, it's always some brown colors.
30:51Now, who knows?
30:53Somebody has some fun with color palettes.
30:56But what we can do on this is we can build some sort of intelligence into this actual output, and use a layer file.
31:04You know, those LYR files that we have? We've had them around for a few years?
31:08We can go and use the symbology from the layer file that exists on disk and apply that symbology to my output.
31:15So I don't have to make the extra step once the tool's run to go and symbolize it.
31:20The software will actually do it for me.
31:23So what we can do is go and… Get into our layers here, and nonvulnerable schools, and now hit Ok.
31:36So 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:46All 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:02And those are my schools that are left over.
32:04So, 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:14And if I go zoom into an area here.
32:19All right. So now you can see all the schools that are left over.
32:22Okay. Pretty neat. Good stuff, right?
32:27And we just did that all on the fly, in just a few minutes.
32:31So, pretty quick to get going with ModelBuilder.
32:36A 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:47So, I'm going to kind of fly through these slides because we've already discussed this and kind of seen what it is.
32:54So the model elements, you have tools and variables and connectors that you have possibly on your actual model.
33:05Adding tools and data to the model; you saw me drag and drop, okay.
33:10We can also use the Add Data or Tool in the ModelBuilder window to go ahead and add information.
33:16So it's pretty easy to get stuff onto that nice drag-and-drop environment.
33:23A 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:31But 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:40And it'll go in and connect all the items together and pull data in if it's not on there.
33:48You 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:01And 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:13So, 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:23As 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:31If 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:40And just a tip in terms of connecting.
34:43Back 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:11So 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:25So 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:35So 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:45The 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:55So if you try and run the model, nothing is going to happen.
35:59What 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:09If it has been run you get the drop shadow.
36:12If you saw that, I had a drop shadow once I ran some of those tools.
36:24And that brings us to the validating here.
36:26And 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:27So if you validate and there's success, it'll return a model from has been run to a ready-to-run state.
36:35If it's unsuccessful, then certain pieces of the model may be white, right?
36:40So they're not ready to run, so you need to go and figure out what the possible problem is.
36:44It may be the geodatabase that you were trying to write to doesn't exist, lots of different possibilities there.
36:50It's always important to validate your model, especially if you're getting it from somebody.
36:54So if you get a model, don't just take it at face value that it's ready to go, right?
36:58Just 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:10Now, creating model tools.
37:11So 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:21Well, all models are essentially tools.
37:25They're a tool in the toolbox.
37:27They just have a little different icon and they may be a workflow of multiple tools.
37:34So, 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:42It says, this tool has no parameters? Okay.
37:45That means that nothing is built into the model that you need to fill in.
37:49You can just hit OK and the model runs, right?
37:54However, 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:01So if you have Buffer in your model you may want to change the distance, you know.
38:07Today I might run it on 2,600 feet tomorrow I might run it on 3,000 feet or 1,000 feet.
38:12I 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:18I can expose that to a dialog, to a tool dialog, okay?
38:23So that's a difference that we're seeing on the screen here.
38:27We have one tool on the left-hand side that has absolutely no parameters in it.
38:32I don't have to fill in anything, I can just hit OK.
38:34The 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:47So, if you ever look at a model and you see the little P beside pieces of the model, that's the parameter.
38:54It 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:05It 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:22That's why I was renaming some of those items.
39:28You can also go and create variables from actual parameters inside of a tool.
39:34So, ModelBuilder will allow you to go and create variables for inputs, right?
39:39So, 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:49So all you need to do is go and right-click on the actual tool.
39:52With 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:59And I'll show you how to do that.
40:05Let's go ahead and make a model tool.
40:10You guys are all very quiet.
40:13Hopefully lunch isn't making you fall asleep, or I'm not incredibly boring.
40:18All 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:25So a few things that I may want to do.
40:27I have a buffer of my Hazmat routes.
40:31What I can do here is right-click on that tool, make a variable from a parameter.
40:36And look, I have all the different sort of possible parameters inside of my tool.
40:41So 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:49Okay, that's a variable element.
40:50That'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:02So what I'm going to do is make this a model parameter, now you see the little P beside it.
41:07And I can go ahead and rename this, so this is going to be my buffer distance.
41:13Okay, so we'll just expand this out a little bit so we can see it.
41:17All 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:29So now I can, on the fly, very quickly, go ahead and change that buffer distance.
41:33I don't have to go back into the actual model interface every time and do that, right?
41:38And notice it took on the name that I have in there, buffer distance.
41:41That's what I named the element as.
41:43So, a few different options there.
41:46You can also go ahead and make output model parameters, okay.
41:52So I'm going to check this off as a model parameter, and here I have the little P. Okay.
41:58So we'll save that one and I'll show you, again, now I have an additional parameter, okay.
42:06My potential shelters and notice it has the output, right?
42:09So I call them potential school shelters in my scratch geodatabase.
42:13Now the nice thing about this is you want to sort of modify this dialog a little bit.
42:17We can go into the properties of this model and go to that Parameters tab that I skipped over at the beginning? 'Kay.
42:24So here's the name of those parameters.
42:27Maybe I want to go ahead and move these, so I can change this one, the buffer distance down to the bottom.
42:33The type, whether it's required or optional.
42:36If it is a parameter from a tool, like distance, that's a required parameter in order to run the buffer tool.
42:43I can't go and change that in this dialog.
42:46Okay, it's going to be required in order to run this tool.
42:50So 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:58So a nice way of making a tool.
43:00Something 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:11So 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:19And I can go to my geoprocessing tools, and I can go ahead and add the tool.
43:26So here we have our tools, and my vulnerability model, and then I can go and drag and drop that.
43:36All right. I can change some information so if I want, maybe, just the name of it, I can change the name.
43:43Let's do text only.
43:45Hit Close, and now I can run that tool just from a toolbar.
43:51Kind of nice.
43:52And you can do that pretty much with all of your geoprocessing tools; scripts, and thinks like that, too.
43:57I 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:08All right. Some tips for designing and sharing your models.
44:15So, what happens to all that data that gets generated on these little intermediate steps to get to your final results?
44:23So I ran a model with two buffers and a union, and then I have an Erase tool, right?
44:30That Erase tool is really going to generate the result that I want.
44:33Those buffers and unions, though, that's just some intermediate processing to get to that.
44:38I don't necessarily want to keep around that intermediate data, right?
44:42It's kind of junk to me.
44:44So I may run it, you know, dump it into a scratch workspace, but then I probably have to go and clean that up.
44:49Well, ModelBuilder, by default, sets those intermediate pieces to intermediate data. Okay.
44:57They do that by default.
44:58So that way you kind of can go and clean that up very easily at the end.
45:04The final output never gets set to intermediate data, though. Okay.
45:08So 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:15You may be screaming at the software because you don't have the intermediate, but that's ok.
45:19All right. Couple things about this, though.
45:23If 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:33You have to go up to the model menu and explicitly click Delete Intermediate Data, okay?
45:40If 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:53You don't have to do the additional step.
45:54So. 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:04Because maybe I do want all those extra intermediate results, all those little buffers and unions that I do there.
46:14So here's some tips for managing that intermediate data.
46:18Do 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:31Okay. You may not have permissions to delete stuff in that geodatabase.
46:35Right? That's going to cause some problems.
46:39Remote 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:49Okay, 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:03Don't clutter your permanent results database.
47:06So, 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:13Put that stuff in a scratch database, right?
47:17You have the ability to make these file geodatabases, you know, whatever you want, generally.
47:23So why not create a scratch geodatabase that you dump all of your intermediate work in, right?
47:28I 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:39Couldn't figure out if anything was even useful.
47:43So, try not to clutter up your workspaces.
47:47Okay. So use the scratch.
47:51All right. The other new thing you can do here is you can take models that you create and embed them in other models.
47:58Okay, so nesting models.
48:00The really nice thing about this is that if you have an extremely complex model, right?
48:06You're running 20 different tools.
48:08You can actually break that model up into smaller pieces and have certain pieces run.
48:14So 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:34So it's really easy to do this.
48:36You can do this at any point with any type of model tool that you have, script tools, things like that.
48:43And it's also nice if you have to collaborate with a bunch of people and you're individually working on different pieces.
48:52Some tips for running models. Running models from ModelBuilder.
48:57As I said, intermediate data is not automatically deleted, so you need to go and actually do this on your own.
49:03The 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:14No background geoprocessing here.
49:16So we have the ability to turn on and off a background geoprocessing.
49:20I 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:44However, if you're running the actual tool inside the ModelBuilder window it will not run in the background at all.
49:51It always runs in the foreground on the screen, okay?
49:54If 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:03Make sure your layout looks decent.
50:08Another 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:23It has to have the little P beside it, okay.
50:26Then you can double-click on the tool and run it and it'll add to the display for you.
50:30So one extra little piece that you need to do there.
50:33And 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:39So it's up to you.
50:43Definitely design your models to be sharable.
50:45Okay, so make them pretty flexible, maybe not as data dependent if you're going to be sharing them.
50:52Set environment settings, relative paths, and so on.
50:55There is a really good read about tips for distributing models; I recommend reading that…
51:05You can also add some additional pieces to your layout.
51:08You can add labels on items so to give some more clarity as to what those things are doing.
51:13And then, new at 10, we have this item descriptions that were added, kind of like a metadata.
51:19You can go and add item descriptions to your models, right?
51:23And then also create help documentation.
51:27In terms of modifying the layout, you have a lot of different options there to sort of move things around.
51:32It does not affect the order that tools run in, right?
51:36They'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:44And you have a couple different modes here with your layouts.
51:47You 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:58Or I can have a manual mode where I actually determine how everything is going to be laid out.
52:05And 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:17Okay. And this is all for layout; it does not affect how the model actually runs itself.
52:22In documenting, 'cause I said you can make labels; you can make some free floating labels if you want.
52:28If you're floatin' around, maybe a title, something like that.
52:31You can make some element labels.
52:33So, if you want to put a little label beside one of the elements in the model to describe things.
52:40You 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:46This is all really good practice for documenting your model, right?
52:51If 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:57But 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:07Another 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:14Little JPEGs in there.
53:16So 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:31All right. Just to show you really quick, let's go ahead and open up our model.
53:38How are we doing for time here?
53:40Fifteen minutes, right?
53:42All right. So, I can do a few things here if I wanted to go ahead and change this to a picture symbol.
53:49And I can go and find…see, there's my junk. I still have a junk folder.
53:57All 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:10And then I can go ahead and change the size of that if I want.
54:13They do lots of things in there.
54:15I can also create little labels.
54:18I create a label and go and change the…what's in here; display properties.
54:32And we can go and change the font and all sorts of things.
54:37You 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:45Just nice little ways of sort of documenting.
54:48And 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:55So you can generate a little help file.
54:57And you can also give the model some additional descriptive information.
55:07All right. Learning more.
55:10So since you've been so quiet, we might actually end it early which means you can probably come up and ask questions.
55:15ArcGIS Online. Okay.
55:17So, through the Resource Center you can get to the help very easily.
55:23You 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:30I 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:41It gets updated when you install things like Service Packs and stuff like that.
55:45The online help is always going to be a little more up to date.
55:50The Geoprocessing Resource Center.
55:52If 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:09We'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:20So lots of stuff you can find in here.
56:23There's presentations that you can get access to.
56:26There's a model and script tool gallery.
56:29Really neat things in here, okay.
56:30I'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:41You can go and add your stuff to this, too.
56:43If 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:54You can also go the Forums directly through here.
56:56There's a geoprocessing blog. Okay.
56:59So go and check this out.
57:00If 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:09The best place to go to get a lot of information very quickly.
57:16And no I don't get paid to just plug the Resource Center.
57:20I just actually really do love it.
57:22All right. So getting more at the conference, okay we're here Wednesday, so I guess that first one is a new point.
57:30But Building Tools with ModelBuilder, okay, we had a session this morning and there's going…
57:33…to be another one tomorrow afternoon.
57:36That is the Advanced ModelBuilder session, if you want something quick and dirty.
57:41It gives you a lot of additional pieces; building actual tools and really building on what I did this afternoon.
57:48And then also come to this Spatial Analysis Showcase.
57:51We 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:01Also, if you just have tools that you want to learn a little more about, definitely come down there.
58:06Okay, and we can handle all sorts of questions from all over the place.
58:10Couple of other things.
58:11Instructor-led training. Okay. We do have a few courses that cover ModelBuilder in little pieces.
58:17There's also some live seminars and recordings.
58:19There's a free one, I think it's 60 minutes, on building models in ModelBuilder.
58:25And then there's a new book that just came out, Getting to Know ArcGIS ModelBuilder.
58:30I believe it is down in the Spatial Outlet, so you can go and check it out there.
58:34It is your introduction to advanced model building.
58:38I think this is the first book that we've actually had that is all about ModelBuilder.
58:43Okay. So, I would go and check it out.
58:45I 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:53So, definitely go and check that out if you need some really good resources for ModelBuilder.
58:58And before you leave, take down this web address.
59:03You want to go to the Esri page, and go to the Session Evals, in order to evaluate this session that I presented today.
59:12And 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:20All right. So have a wonderful afternoon and enjoy the rest of your conference.
Getting Started with ModelBuilder
Leah Saunders shows how to use ModelBuilder to create, edit, and run model tools.
- Recorded: Jul 13th, 2011
- Runtime: 59:27
- Views: 85095
- Published: Sep 19th, 2011
- Night Mode (Off)Automatically dim the web site while the video is playing. A few seconds after you start watching the video and stop moving your mouse, your screen will dim. You can auto save this option if you login.
- HTML5 Video (Off) Play videos using HTML5 Video instead of flash. A modern web browser is required to view videos using HTML5.