Update a model in Map Viewer
Open a model
First, you'll browse to and open a shared analysis model. Then, you'll create a copy of the model so that you can edit it. To see how the model used in this tutorial was built, see the tutorial Get started with ModelBuilder in Map Viewer.
- Sign in to your ArcGIS organizational account.
Note:
If you don't have an organizational account, see options for software access.
- On the ribbon, click Map.
A blank map opens.
- On the Settings (light) toolbar, click Analysis.

The Analysis pane appears.
- In the Analysis pane, click ModelBuilder.
Note:
If you do not see the ModelBuilder tab, it may mean you do not have the required licensing to use ModelBuilder.

The ModelBuilder pane appears. It includes options to connect to an analysis session, create a model, or browse and open an existing model.
- Click Browse analysis models.

The Browse analysis models window currently shows analysis models from My content. Any models you've created or saved will appear here. Since the Texas rail model is owned by another organization, you'll change the search portal to ArcGIS Online.
- Click the arrow next to My content and choose ArcGIS Online.

The list of available models updates to show models shared publicly.
- In the Search box, type Rail EOP and add the search term owner:Esri_Tutorials.
- Select the Rail EOP analysis model created by Esri Tutorials.
- Click Confirm.

The model is opened in view-only mode in your web map and the model name is listed in the ModelBuilder pane under Models in this map. When a model is in view-only mode, you can view the tool windows but you cannot edit the model until you've created your own copy.
View-only mode allows you to evaluate existing models. You can make the ModelBuilder diagram bigger to help you see the elements and variables better.
- Close the Layers pane. On the ModelBuilder diagram, click Expand to make the window bigger.
Now that you have added and reviewed the model, you'll save the web map.
- On the Contents (dark) toolbar, click Save and open and choose Save as.

- In the Save map window, for Title, type Rail transport near schools in California.
- Update the tags to include Rail lines, School safety, tutorial, ModelBuilder, and California.
- For Summary, type An analysis of rail lines near schools in California.
- Click Save.
The web map is saved to your user account. Next, you'll make a copy of the shared model you opened in view-only mode. If you want to edit or run the model, you need to make a copy that you own.
- On the model toolbar, click Save as.

The Save analysis model window appears.
- In the Save analysis model window, provide the following information:
- For Title, type California Rail EOP and add your name or initials to ensure the title is unique to your organization.
- For Tags, type Rail lines, EOP, School safety, and California
- For Summary, type Analysis model identifying the schools within 0.5 and 1 miles of rail lines in California to ensure that districts are fulfilling their safety planning requirements.
- Click Save.
The model is copied and the new model opens in view-only mode.
Edit the model
The existing model summarizes the number of public schools within 1,000 yards of rail lines in Texas based on state-specific requirements. You'll edit the model so the analysis takes place in California and change the buffer distance to 0.5- and 1-mile radiuses. You'll also add the Enrich Layer tool to the model to find the total population within 1 mile of rail lines.
Before you can start editing the model, you'll need to connect to an analysis session and make the model active. In analysis sessions, credits are charged by how long the session is active.
- In the ModelBuilder pane, under Analysis session, click Connect.
The time elapsed in the session and number of credits consumed are displayed in the Analysis session section.
The model must also be made active before you can edit it. While you can open and view multiple models in the map at the same time, you can only have one active model.
- In the model diagram, for the California Rail EOP model, click Make active.
Note:
If the Make active button is not available, it may mean you have not connected to an analysis session or you are not viewing the version of the model that you saved.
You'll start by updating the model to filter the USA Counties layer to the state of California instead of Texas.
- Double-click the Filter by Attributes element to open the tool window.

The tool is currently using the expression STATE_NAME = 'Texas'. You'll update it to STATE_NAME = 'California'.
- For the Expression parameter, click the edit button.

The Query builder window appears. The window has drop-down menus for State Name, equals, and Texas.
- Click the arrow next to Texas.
A menu appears listing state names. These are the unique values in the State Name field.
- From the menu, choose California.

- Click Add.
The expression in the Filter by Attributes tool window updates to read STATE_NAME = 'California'.
The remaining parameter for this tool is Result type, which is set to Create intermediate data. Intermediate data layers don't get published as feature layers and aren't added to the map, which speeds up model performance. Since you don't need to see this output, you'll keep the filter result as an intermediate layer.
- Click Confirm.
The tool window closes and the model validates.
Next, you'll update the buffer distance and units. The Create Buffers tool was added to the model with two variables: Distance values and Units. These variables make it quicker for you to change the buffer parameters without the need to open the tool window.

- Double-click the Distance values variable.
The Distance values window appears. The value is set to 1,000.
- Delete the value 1,000. In the text box, type 0.5 and press Enter.
The value 0.5 is added below the text box. Adding multiple distance values to the buffer will create two buffer rings in the output layer.
- Type 1 and press Enter.
A second value is added.

- Click Confirm.
The variable updates and validates. You'll also update the Units variable from Yards to Miles.
- Double-click the Units variable. Set the variable to Miles and click Confirm.
The Units window closes and the model validates.
The next tool after Create Buffers is Dissolve Boundaries. This tool combines all of the buffer polygons into a single polygon per county. The dissolve field is currently Name, which dissolves all buffers based on the name of the county. Since you added a second buffer distance in Create Buffers, you'll need to add the buffer distance field in the dissolve settings to ensure the boundaries are dissolved if they share both a county and a buffer distance.
- Open Dissolve Boundaries.
- Under Dissolve settings, in the Fields to match parameter, click the Field button and choose the Buffer distance in Miles field. Click Done.

The tool will now dissolve boundaries between polygons that have the same county and buffer distance.
- Click Confirm.
The final edit you'll make to the existing tools in the model is to change the output hosted feature layer. This is one of the output layers that you're adding to the map, so you'll change the name. This will also ensure you don't overwrite the results for Texas.
- Double-click the Summarize Within element.
- Change the output name to Public_schools_summarized_CA_YN and replace YN with your initials. Click Confirm.

- Double-click Overlay Layers 1 and update the Output name to CA_YN instead of TX.
- On the model toolbar, click Save.
The model is now updated to perform the analysis in California.
Add tools
The model now summarizes the number of public schools within 0.5 miles and 1 mile of rail lines in California. You want to also calculate the total population within 1 mile of rail lines. You'll do that by filtering the summarized output to the 1-mile buffers and using the Enrich Layer tool to add demographic data.
- On the action toolbar, click Add tools.

- In the search bar, type filter. Click the Filter by Attributes tool to select it.

- Search for and select the Enrich Layer tool.
Both tools are selected.
- Click Add.

The two new tool elements and their outputs are added to the model diagram. The Enrich Layer element has an icon indicating it is a premium tool. Premium tools charge additional credits when run in ModelBuilder at the same rate as the equivalent tool run from the tool pane. In this case, Enrich Layer will consume an additional 0.53 credits when the model is run.
The next step in the model is to filter the output layer from Summarize Within, so you'll update the tool parameters for Filter by Attributes first.
- Double-click Filter by Attributes 1. In the tool window, for Input dataset, click Layer.
The Select layer window appears, listing the datasets and data variables available in the model.
- In the Select layer pane, click Summary polygons.

The Summary polygons variable is added as the input for Filter by Attributes 1.
- Under Expression, click Build new query.
The Query builder window appears with options for an expression or expression group. You need to filter one field (buffer distance), so a simple expression will work.
- Confirm Expression is selected and click Next.
Next, you'll start building the expression. The default field name chosen in the expression is Count, which is not the field you want to use to build your expression.
- Click Count and choose Buffer distance in Miles.
- For the operator, confirm that equals is selected.
- Click Enter value and type 1.

- Click Add. Click Confirm.
The Filter by Attributes 1 tool validates and turns yellow, indicating all required parameters are set. The last tool you need to update is Enrich Layer. The Enrich Layer tool allows you to add demographic and landscape data from the ArcGIS GeoEnrichment Service to your layer. You'll use this to add population data to the rail buffers to help you analyze how many people live near the rail lines that potentially could be impacted by a hazardous material spill. You'll use the output from Filter by Attributes 1 as the input for Enrich Layer.
- Connect Filtered result to the Enrich Layer variable and choose the Input features parameter.

You'll need to update the remaining parameters on the tool dialog box.
- Double-click the Enrich Layer element. For Enrichment variables, click Variable.
The Data Browser window appears. By default, the region is set to Global. The only variables available globally are in the Population category. You can change the region to see additional variables available for your data. However, in this case, it is not necessary since you are looking for a population variable.
- Click Population.

The variables in the Population category are listed.
- Choose Total Population and click Select.

The Total Population variable is now listed on the tool window under Enrichment variables.
Finally, you'll set the tool's output as a hosted feature layer.
- For Result type, click Create intermediate data and choose Create hosted layer.
- For Output name, type Pop_near_rail_lines_CA_YN.

- Click Confirm.
The tool window closes and the tool element validates and turns yellow. Now that all tools have been validated, the model is ready to run.
Run the model
Next, you'll save and run the model.
- On the model toolbar, click Auto layout and Fit to window.

The model layout updates so you can see all tools in the window.
- On the model toolbar, click Run.
The model runs and three outputs are created: Summary polygons showing the count of public schools near schools, point locations showing schools near rail lines, and an enriched layer including the total population near rail lines.
Note:
You can click the History tab to view details about the model run.
- On the model toolbar, click Save.
Now that you've run and saved the model, you can disconnect from the analysis session.
- In the ModelBuilder pane, click Disconnect.
- Close the ModelBuilder diagram.
The output layers are now visible on the web map. The default symbols don't show the results of your analysis, so you'll update the style of the final output layer.

- On the Contents toolbar, click Layers.
The Layers pane appears with the three output layers listed. You'll update the style of Pop_near_rail_lines_CA.
- In the Layers pane, for the Public_schools_summarized_CA and Schools_near_rail_lines layers, click Hide to hide the layers from the map.
- Click Pop_near_rail_lines_CA to select it.

- On the Settings toolbar, click Styles.
The Pop_near_rail_lines_CA layer includes the output fields from both the Summarize Within tool and Enrich Layer tool, so you can style the layer by both the count of schools near rail lines and the total population.
- Click Field.

The Select fields window appears with the fields of the dataset listed.
- Select Count of Points and Total Population. Click Add.
Count of Points and Total Population are both listed as attributes.
- Under Pick a style, scroll down and click Relationship.

The map updates to show the relationship between the two attributes. The brown polygons have a high number of schools and high total population near railroads. Blue polygons have a high number of schools but a low total population, and orange polygons have a low number of schools and high total population near railroads.

- Click Done.
- On the Contents toolbar, click Save and open and choose Save.
In this tutorial, you opened a shared model and created a copy of it. Then, you edited the model by updating parameters and adding tools. Finally, you ran the model to create results summarizing public schools near rail lines in California.
You can find more tutorials in the tutorial gallery.
