Create a model

First, you'll open a shared web map and save a copy in your ArcGIS organization. This map contains two of the layers you'll need for your analysis as well as an example of the model you'll build. You'll connect to an analysis session and begin creating your model.

Open a map

You'll open a web map with layers showing rail lines and public schools in the United States. Then, you'll sign in and save a copy of the map to use in your analysis.

  1. Open the Rail transport near schools web map.

    Rail transport near schools map

    The map has two layers: Public School Locations – Current and North American Rail Network Lines. The map is currently showing the North American Rail Network Lines layer.

  2. On the ribbon, click Sign In. Sign in to your ArcGIS organizational account.
    Note:

    If you don't have an organizational account, see options for software access.

  3. On the Contents (dark) toolbar, click Save and open and choose Save as.

    Save as option

  4. In the Save map window, click Save.

    A copy of the web map is saved to your account.

Explore a model

Before you start building an analysis model, you'll explore ModelBuilder and use a completed model to understand the workflow.

  1. On the Settings (light) toolbar, click Analysis.

    Analysis button

    The Analysis pane appears.

    Note:

    If you do not see the Analysis tab, it may mean you do not have the required licensing. For information on the licensing you'll need for this tutorial, see Requirements for ModelBuilder.

  2. In the Analysis pane, click ModelBuilder.

    ModelBuilder button in the Analysis pane

    The ModelBuilder pane appears.

    A model called Rail EOP is listed under Models in this map. This model was created by the Esri Tutorials team and shared with the public, so you can open the model in view-only mode.

  3. Next to the model name, click the Options button and choose Open to view only.

    Open to view only option

    The model opens in view-only mode. When a model is in view-only mode, you can view the tool parameters, but you can't edit the model.

    Depending on the size of your screen, it may be difficult to see the model elements. You can increase the size of the canvas and zoom and pan on the model to see each element better.

  4. In the Legend pane, click Close.

    The side panel closes and the ModelBuilder pane expands horizontally.

  5. On the ModelBuilder canvas, click Expand.

    Expand button

    The ModelBuilder canvas increases vertically.

  6. In the upper left of the model pane, click Zoom in until you can read the labels on the model elements. On the layout toolbar, click Pan.

    You can now click and drag the canvas to view different areas of the model.

  7. Drag the canvas so you can see the beginning of the model.

    The first input is a data variable called USA Counties Generalized Boundaries – USA Counties – Generalized. It's connected to the Filter by Attributes tool.

  8. Double-click Filter by Attributes.

    Filter by Attributes element

    The Filter by Attributes parameters open in view-only mode. Under Input dataset, the USA Counties Generalized Boundaries layer is listed. The Expression parameter shows the query as STATE_NAME = 'Texas'.

  9. Close the Filter by Attributes window.

    The next tool in the sequence is Overlay Layers. The inputs to that element are the output from Filter by Attributes and the North American Rail Network Lines variable.

  10. Open Overlay Layers and review the parameters.

    The tool creates an output of lines where the North American Rail Network Lines intersect the filtered counties. In other words, the North American Rail Network Lines are clipped to Texas.

  11. Close the Overlay Layers tool parameters.

    The Intersecting rail lines output is connected to the next tool, Create Buffers. Create Buffers has two additional inputs: Distance values and Units. These inputs are value variables and are connected to the Create Buffers tool's Distance values and Units parameters.

  12. Open Create Buffers and review the parameters.

    The variables appear as the inputs to the Distance values and Units parameters. The tool will create 1,000-yard buffers around the rail lines in Texas.

  13. Review the remaining tools.

    Dissolve Boundaries dissolves the buffers by county to create a feature for each county showing the area within 1,000 yards of rail lines.

    The final tools in the model are Summarize Within and a second Overlay Layers. Summarize Within summarizes the count of public schools inside the dissolved buffer output. Overlay Layers returns the public school locations within the dissolved buffers. These tools will also create hosted feature layers, rather than intermediate layers.

  14. Close the model.

    Close button

Create a model item

Now that you're familiar with the analysis workflow, you'll connect to an analysis session and create an analysis model item. Analysis sessions provide compute resources for analysis models, which enable interactive editing, validation, running models, and temporary storage of intermediate data. In analysis sessions, credits are charged by how long the session is active.

  1. In the Analysis session section, click Connect.

    Connect button for Analysis session

    Connecting to an analysis session consumes credits. The time elapsed in the session and number of credits consumed are displayed in the Analysis session section.

    For more information on credit consumption in ModelBuilder, see Analysis sessions.

  2. Click Create model.

    The Create analysis model window appears.

  3. In the Create analysis model window, set the following parameters:
    • For Title, type Rail EOP and add your name or initials to the end.
    • For Tags, type Rail lines, EOP, School Safety, and Texas.
    • For Summary, type Analysis model identifying the schools within 1,000 yards of a rail line in Texas to ensure that districts are fulfilling their safety planning requirements.

    Create analysis model window

  4. Click Save.

    The empty canvas appears where you will build the new analysis model. The blue check mark next to the model name indicates the model is active, which means it can be edited and run.

    Active model

  5. If necessary, click Expand to make the canvas larger.

    The canvas is now ready to start building your model.

You saved a copy of a web map, explored an existing model, and created a new model. Next, you'll build the model by adding and connecting data and tools.


Build a model

A basic analysis model consists of data elements and tools that are connected to create a workflow. You'll add data variables and tools to the model, connect the data and tools, and update the tool parameters.

Add data and tools

Models are built using data and tools, with the output of one tool being used as the input to another tool. The data and tools are connected to form a complete workflow.

You'll start by adding the datasets from the map to the model.

  1. On the action toolbar, click Add data.

    Add data button on action toolbar

    You can add data from several sources. In this case, the rail line and public school layers are already on the map and can be added directly to the model.

  2. Click Add layers from map.

    Add layers from map option

    The Add layers from map window appears with a list of the layers that are currently on the map.

  3. Click the two layers to select them and choose Add.

    Add button

    Two input data variables are added to the model representing the two layers. The variables turn blue, indicating that they have been validated.

    Model with two layers

    Your analysis will focus on schools and rail lines in Texas, but these datasets cover the United States and North America, respectively. You'll need to clip both of these layers to only show features within Texas. To do this, you'll need a layer not currently on the map, one showing the boundary of Texas. You can find this data in ArcGIS Living Atlas. Unlike the other layers that you added as variables, you'll select this layer directly in the analysis tool it'll be used in.

  4. On the action toolbar, click Add tools.

    The Add tools window appears.

  5. In the Search a tool text box, search for and select the Filter by Attributes tool.

    Filter by Attributes tool

    Filter by Attributes is a tool that filters a dataset using an attribute query. It's specific to ModelBuilder. In Map Viewer, a comparable tool is Filter by Attributes and Location.

  6. Click Add.

    A tool variable for Filter by Attributes is added to the diagram. The tool and its output appear gray because the required parameters are not set. This means that the tool isn't ready to run.

    Tip:

    To move the variables to a more optimal position, click Auto layout and Fit to window on the layout toolbar throughout the workflow.

    Model toolbar with Auto layout and Fit to window buttons

  7. Double-click the Filter by Attributes variable to open it.

    Alternatively, you can select the variable and click Open on the element toolbar.

    Open button

    The tool window appears. The Input dataset, Expression, and Result type parameters are marked with a red dot, meaning they are required.

  8. Under Input dataset, click Layer.

    Layer button

    The Select layer window appears, listing the model variables and the map layers. The dataset you're looking for isn't available in these lists, so you'll browse for it.

  9. Click Browse layers.

    The Select layer window appears, listing the layers from My content. You'll change the filter to show layers from ArcGIS Living Atlas.

  10. Click My content and choose Living Atlas analysis layers.

    Living Atlas analysis layers option

    ArcGIS Living Atlas analysis layers have been optimized for analysis by generalizing polygons and removing unnecessary fields.

  11. In the Search box, type USA counties.

    A county layer will allow you to filter by the state name while also providing smaller geographical boundaries to use when dissolving the buffers later in the workflow.

  12. For USA Counties Generalized Boundaries, click Select layer and choose USA Counties – Generalized.

    USA Counties - Generalized option

  13. Click Confirm.

    The ArcGIS Living Atlas analysis layer is added to the tool window. Next, you'll create an expression to filter the dataset.

  14. Under Expression, click Build new query.

    Build new query button

    The Query builder window appears with options for an expression or expression group. Your expression just needs one statement, a query to filter counties where the state name is Texas, so you'll just need one expression.

  15. Confirm Expression is selected and click Next.

    Next, you'll start building the expression. The default field name chosen in the expression is OBJECTID.

  16. Click OBJECTID to expand the menu of field names and choose State Name.
  17. For the operator, confirm that equals is selected.
  18. Click Enter value to open a menu of values for the State Name field and choose Texas.

    The expression now reads State Name equals Texas, which will filter the dataset to counties in Texas.

  19. Click Add.

    Add button in the Query builder window

    The Expression parameter is updated with the new expression.

    The remaining required parameter is Result type, which has Create intermediate data selected by default. Intermediate datasets don't get published as hosted feature layers, which helps speed up model runs. But intermediate datasets also don't get added to the map, so they are most appropriate for steps in the model that don't need to be visualized. If you're creating a final dataset or something that you need to visually confirm, use the Create hosted layer output.

    You'll keep Result type set to Create intermediate data for this tool.

  20. Click Confirm.

    Model builder canvas with the configured filter tool

    The tool validates the parameters you've set and changes to yellow, meaning it is now ready to run. The icon on the output dataset indicates that the variable is intermediate data.

    Next, you'll rename the output dataset variable. As your model grows, renaming model elements can make it easier to tell what dataset or result you're working with.

  21. Click the Filtered result variable to select it. On the element toolbar, click Rename.

    Rename button on Filtered result element

  22. Type Filtered counties and press Enter to apply the change.
  23. On the model toolbar, click Save.

    Save button on the model toolbar

    The first step in the model is now complete.

Overlay the rail lines

Filter by Attributes will filter the county boundaries to Texas. The output data can be used to overlay on the North American Rail Network Lines dataset to find the rail lines that intersect the Texas counties.

  1. Click Add tools and search for intersect.

    The list is filtered to only include Overlay Layers, which combines two layers into a single layer using intersect, union, or erase overlays.

  2. Click Overlay Layers and click Add.

    Add button for the Overlay Layers tool

    An Overlay Layers variable is added to the diagram.

    Overlay Layers requires two input datasets: Input features and Overlay features. The input features layer is the one you want to clip. The output dataset layer is the geometry you want to clip that data to.

  3. Click the node on the right side of the North American Rail Network Lines input data variable and drag the connector to the left side node of the Overlay Layers variable.

    The Select input menu appears below the tool variable listing the compatible tool parameters. In this case, the North American Rail Network Lines variable is compatible with Input features and Overlay features.

  4. For Select input, choose Input features.

    Rail layer with connection to the Overlay Layers tool.

    Note:

    Your model layout may look different. The placement of the model elements doesn't matter as long as the connectors are the same.

    A connector is added to the model linking North American Rail Network Lines to Overlay Layers. The tool is still missing a dataset for the Overlay features parameter.

  5. Connect the Filtered counties output data variable to the Overlay Layers tool variable and choose Overlay features.

    Because the Overlay Layers tool now has the two required inputs, the variable is no longer gray, indicating that it's ready to run. However, you'll need to review the default parameters to ensure you get the correct output.

  6. Double-click the Overlay Layers variable to open the tool window.
  7. For Overlay type, ensure that Intersect is chosen.

    Intersect option for the Overlay type parameter

    The tool will return the rail line features that intersect the Texas counties.

  8. For Output geometry, choose Line.

    Line option for the Output geometry parameter

  9. Keep Result type set to Create intermediate data.
  10. Click Confirm.

    The tool window closes and the tool element validates again.

  11. Rename the Overlay result variable to Intersecting rail lines.
  12. On the model toolbar, click Save.

    The model workflow now filters a layer of county boundaries to Texas, then clips the rail network to the state.

Buffer and summarize

The final next step in the workflow is to create a 1,000-yard buffer around the clipped rail lines and find all the public schools that fall within the buffer.

Note:

This workflow uses Create Buffer and Summarize Within to make each step in the model workflow more explicit. The same result can be created using Summarize Nearby. There is negligible difference in the time it takes to run a model with Create Buffer and Summarize Within versus Summarize Nearby.

  1. Click Add tools.
  2. Search for and select Create Buffers, Dissolve Boundaries, Summarize Within, and Overlay Layers.

    Four tools are selected.

  3. Click Add.

    Four tools in the model

    Tool elements for the selected tools are added to the model. Overlay Layers is called Overlay Layers 1 because there is already a variable called Overlay Layers.

    Tip:

    As you continue building your model, click Auto layout and Fit to window to rearrange elements as needed.

  4. Connect Intersecting rail lines to the Create Buffers variable and set it as the Input layer.

    Rather than updating the buffer distance and unit parameters from the tool window, you'll add variables for those parameters, which will make it faster to update the values in the future.

    These variables will hold a value and be used as inputs for specific parameters. Using variables can make iterating on tool parameters faster because you can change the specific variable values without opening the full tool dialog box. These variables will be useful if you want to rerun the model with different buffer distances in the future, such as in the tutorial Update a model in Map Viewer, the next tutorial in this series.

  5. Click the Create Buffers element. On the element toolbar, click Add variable and choose Units.

    Units option

    A string variable is added to the model and connected to Create Buffers.

  6. Double-click the Units variable to open it. Expand the menu and choose Yards.

    Yards option

  7. Click Confirm.
  8. For Create Buffers, add a Distance values variable and set the value to 1000.

    The Create Buffers element validates and turns yellow because all the required parameters are now set.

  9. Rename the Buffer result variable to Buffered rail lines.

    Buffered rail lines variable

    The next step is to dissolve the rail buffers in each county.

  10. Open the Dissolve Boundaries tool window and update the following parameters:
    • For Input features, choose Buffered rail lines.
    • For Fields to match, choose Name.
    • Enable Create multipart features.
    • For Result type, choose Create intermediate data.

    Parameters for the Dissolve Boundaries tool

  11. Rename the Dissolve Boundaries output variable to Buffered rails by county.

    Next, you'll use the Summarize Within tool to count the number of schools in each county that lie within 1,000 yards of a railroad track. This layer is the first of two that you'll save as a hosted feature layer so you can analyze it on the map later.

  12. Open the Summarize Within tool window and update the following parameters:
    • For Input features, choose Public School Locations - Current.
    • For Area type, choose Polygon layer.
    • For Summary polygon layer, choose Buffered rails by county.
    • For Result type, choose Create hosted layer.
    • For Output name, type Public_schools_summarized_TX_YN (where YN is your initials).
    • Check If a layer exists with the same name, automatically overwrite it.

    Summarize Within tool parameters

    The Summarize Within element validates and turns yellow. The output variable has a different icon than the other outputs in the model that indicates it is a hosted layer.

    Note:

    The Group by summary table output variable is gray because you are not using the optional Group by field parameter in Summarize Within. Only the validated Summary polygons variable will create an output.

    Finally, you'll use the Overlay Layers tool to intersect the public school locations with the buffered railroads.

  13. Open the Overlay Layers 1 tool window and update the following parameters:
    • For Input features, choose Public School Locations – Current.
    • For Overlay features, choose Buffered rails by county.
    • For Overlay type, choose Intersect.
    • For Output geometry, choose Point.
    • For Result type, choose Create hosted layer.
    • For Output name, type Schools_near_rail_lines_TX_YN (where YN is your initials).
    • Check If a layer exists with the same name, automatically overwrite it.

    Final model

    The full model is now complete and ready to run.

  14. On the model toolbar, click Save.

You added three datasets and six tools to a model to create a complete workflow. Next, you'll run the model and share it with your organization.


Run and share the model

Now that the model is complete and all tools are validated as ready to run, you'll run the model. Then, you'll share the model so it is available to other members of your organization.

Run the model

Running the model will run each of the tools in sequence. When the model finishes running, the hosted feature layers created from Summarize Within and Overlay Layers will be added to the map.

Note:

Running the model will not consume additional credits for the tool runs. Only premium tools, which are not used in this workflow, consume additional credits when run in ModelBuilder.

  1. If necessary, click Auto layout and Fit to window.

    You can now see the full chain of analysis tools in the model.

  2. Click Run.

    Run button

    The model runs. The tool elements turn red as each tool is run. When the model finishes running, the hosted layers are added to the map.

    Now that the model has run and you've verified it generated the expected results, you can save the model and disconnect from the analysis session.

  3. Click Save.
  4. In the ModelBuilder pane, click Disconnect.

    The analysis session disconnects and credit consumption stops.

    Since you are no longer working with the model, you can make more space for the map.

  5. Close the ModelBuilder diagram.

    You can also hide the North American Rail Network Lines layer from the map so that only the result layer is visible.

  6. If necessary, open the Layers pane. For the North American Rail Network Lines layer, click Hide.

    Hide button for the North American Rail Network Lines layer

    Now you can see the two output layers generated by your analysis.

    Output layers generated by analysis

    Your work on building and running the model is now complete.

Share the model

Sharing a model with your organization is an important step in collaboration and transparency. The members of your organization can open and view the shared model, including opening the tool parameters, which allows stakeholders to understand the full analysis. Members of the organization can also create editable copies of the model, enabling them to run the analysis themselves if necessary.

  1. In the ModelBuilder pane, under Models in this map, for the Rail EOP YN model, click the options button and choose Share model.

    Share model option

    The Share window appears. There are options to share the model with your organization, everyone, or selected groups.

  2. For Set sharing level, choose Organization.

    Organization option

  3. Click Save.

    The sharing level is updated for the analysis model item.

  4. On the Contents toolbar, click Save and open then choose Save.

    The updates to the web map, including adding the new output feature layers, are saved.

You ran the analysis model to create a hosted feature layer output summarizing the number of public schools within 1,000 yards of a rail line. You also shared the model with members of your organization so they can open the model and see the workflow or create a copy to edit and run themselves.

You can find more tutorials in the tutorial gallery.