Create layers for analysis

In this section, you'll start by creating layers, which is how maps store data that can be used in analysis. Layers are listed in the legend. You'll create these layers so you can organize 4 inspectors with the 36 restaurants they'll visit. Your inspectors will start these routes from their homes and complete their shifts at the Retail Food Monitoring Office, where they'll file reports and gather assignments for the following day.

Create a layer for the headquarters

You'll begin by opening a new map and creating a point layer representing the Retail Food Monitoring Office, the headquarters for San Diego County's food inspection program.

  1. Sign in to your ArcGIS organization account or into your ArcGIS Enterprise using a named user account.
    Note:

    If you don't have an organizational account, you can sign up for an ArcGIS free trial.

  2. On the organization home page, at the top of the site, click Map.

    Map button

    A map opens with the Esri Topographic basemap, a reference layer that provides geographic context.

    United States

    Note:

    The default map is set by the administrator of your ArcGIS Online organization, so your map may look different. If so, don't worry. It won't affect your ability to follow the steps.

    First, you'll create a map layer for the Retail Food Monitoring Office.

  3. In the search box at the upper right, begin typing 5500 Overland Ave San Diego California, 92123.

    Search box

    As you type, a list of possible matching addresses displays. When you choose an address from the list, ensure that you are choosing the address with the correct city and state.

  4. Click the matching address when it appears in the search box.

    Address

    The map zooms to the location of the headquarters. You may need to zoom out one level to see Overland Avenue.

    Search result

    The map currently shows the end of a cul-de-sac. That's okay, because it's not the physical location of the Retail Food Monitoring Office but the spot that reflects its geospatial address. (This will matter in the next lesson when you use the Plan Routes tool.) To see the actual location of the building, you'll change the basemap to one that displays satellite imagery.

  5. On the ribbon, click Basemap and choose Imagery.

    Basemap

    The map updates to show an image of the location.

    Building

    The actual location is the large white building on the left.

    The Search result pop-up on the map is temporary, so you need to create a more permanent map notes layer for that feature. A map notes layer stores points, lines, and areas. As the name implies, it can also be used for text.

  6. In the Search result pop-up, click Add to Map Notes.

    A blue marker is placed at the spot where the pop-up was pointing. The side pane also changes from About to Contents, which shows the map layers. You will need to make the Map Notes layer permanent, so you can conduct analysis in the next lesson.

  7. In the Contents pane, point to the Map Notes layer and click the More Options button.

    More Options

  8. In the More Options menu of the Map Notes layer, click Rename.

    Rename

  9. In the Rename window, clear the text and type Retail Food Monitoring Office.

    Rename text

  10. Click OK.

    You still need to change the blue marker to a more prominent symbol.

  11. Click the blue marker and click Edit.

    Edit

    A Points pop-up appears with the office's address in the Title box. That's valuable information—it's just not in the right place for the work you're doing.

  12. In the Points pop-up, cut the street address from the Title box and paste it into the Description box.
  13. In the Title box, type Retail Food Monitoring Office.
  14. In the Description box, in the upper left corner, type The headquarters for San Diego County's retail food inspection program. Address:5500 Overland Ave San Diego California, 92123.

    Description

  15. Click Change Symbol.

    The Change Symbol window shows the symbols of the default Shape style. You can choose symbols from other styles.

  16. Change the style category from Shapes to Basic.

    Shape

  17. Scroll to the end of the Basic symbols and click the yellow flag symbol.

    Yellow flag

    You can choose any symbol you want, but flags with staffs suggest a headquarters location.

  18. Click OK.
  19. In the Points pop-up, click Close.
  20. Click the arrow at the upper right of the Add Features pane to close it.

    Close window

  21. Change the basemap back to Topographic.

    Topographic

  22. Click the yellow flag on the map. The resulting pop-up describes the Retail Food Monitoring Office and reveals its address. The box includes a link for getting directions.

    Pop-up

  23. Close the pop-up.

    At this point, Retail Food Monitoring Office is still a temporary layer in your map. You need to save it as a permanent layer.

  24. In the Contents pane, point to the Retail Food Monitoring Office layer. Click the More Options button and choose Save Layer.

    Save Layer

  25. In the Create Item window, for the tags, type food, monitoring, San Diego County.
    Tip:

    Separate the tags with commas or press Enter after each tag.

  26. For the summary, type The headquarters for San Diego County's food monitoring program.
  27. Save the layer in a folder of your choice.
  28. Click Create Item.

    Create item

    Retail Food Monitoring Office is saved as a permanent layer to My Content.

Save the map

Now that you've created the headquarters layer, you'll save the map.

  1. On the ribbon, click the Save button and choose Save.

    Save

  2. In the Save Map window, for the title, type Routes to Restaurants.
  3. For the tags, type restaurant, inspection, San Diego County.
  4. For the summary, type Routes to restaurants in San Diego County.
  5. Save the map in a folder of your choice.

    Save map

  6. Click Save Map.

    You've created a layer for the Retail Food Monitoring Office as a single point feature using Map Notes. Next, you'll create layers for the inspectors' homes as well as the restaurants they'll inspect.

Download the CSV files

To plan the routes for your four inspectors, you'll need two layers: one for their starting points (their respective homes) and a second for their stops (the 36 restaurants). You'll create these two layers using comma separated values (CSV) files. In these files, the information for each record (a home or restaurant) is in a row, and the attributes (fields) for the features are separated by commas.

The addresses in CSV files can be geocoded onto a map in ArcGIS Online. Geocoding is a GIS operation for converting street addresses to spatial data so they can be mapped.

You'll download two CSV files and use them to geocode the addresses on your map. One CSV file contains the addresses for the 36 restaurants your team will inspect. The second contains the addresses for the homes of your inspectors.

  1. If necessary, open your Routes to Restaurants map.
  2. Open the Plan Routes for Food Inspectors group.

    This group contains two items. These are the CSV files for the homes and the restaurants.

  3. Click the thumbnail image for the Restaurants CSV file to download the file.

    CSV files in group

    Depending on your browser, the CSV file may appear on your downloads bar, or you may be prompted to open or save the file.

  4. Download the Restaurants CSV file to a location on your computer. Remember the location so you can browse to it.
  5. Download the Homes CSV file and save it to the same location on your computer.
  6. Open the Restaurants file in WordPad or Notepad (or any other text file editor).
    Tip:

    Opening the CSV files could default to your spreadsheet program, such as Microsoft Excel. To open in a text file editor, you may need to right-click the CSV file and choose a program.

    At first glance, the data in CSV files may appear jumbled. That's because CSV files store numbers and text in a common and adaptable format so it can be imported into different programs.

    This file has the names and addresses of the 36 restaurants. Note that there is a single address field with the complete address for each restaurant—the full address is a single field value contained within the quotation marks. You'll use this file to create the Restaurants layer for your map.

  7. Close the file.
  8. Open the Homes file in a text file editor.

    CSV homes

    The file has the home addresses of your four inspectors. Note that the full address for each inspector is in four different fields: Address, City, State, and ZIP_Code. You'll use this file to create the Homes layer for your map.

  9. Close the file.

Create a layer for the restaurants

Next, you'll create a layer for the locations of 36 restaurants.

  1. On the ribbon, click the Add button and choose Add Layer from File.

    Add Layer from File

  2. Browse to and choose the Restaurants CSV file that you downloaded and saved on your computer.

    Add layer window

  3. Click Import Layer. If necessary, for In, choose United States.

    Add CSV

  4. Click Add Layer.

    Map with restaurants symbolized

    The Restaurants layer is added to the map and the Change Style pane opens so you can modify the symbols if you want. Because there is no need to distinguish among the individual restaurants for the inspectors, you'll modify the symbols so they are easier to see.

Modify layer symbols

You'll modify the symbols so they'll stand out on your map.

  1. In the Change Style pane, for Choose an attribute to show, choose Show location only.

    Change Style

  2. For the Location (Single symbol) drawing style, click Options.

    Select drawing style

  3. Click Symbols to change the symbols.

    Symbols

  4. Change the symbol category from Basic to Shapes.
  5. Scroll down, select the red circle, and change Symbol Size to 16 pixels (px).

    Red circle

  6. Click OK.
  7. In the Change Style pane, click OK. Click Done to finish changing the symbols.

    Single symbol

    The map now shows all the restaurants with the single symbol you specified.

Verify the geocoding results

When you geocode address locations using a CSV file, you should verify the results. One way to check the results is to verify the number of addresses that were found. A second is to check that the addresses are correctly geocoded.

You can verify the number of addresses by opening the layer's table.

  1. In the Contents pane, point to the Restaurants layer and click the Show Table button.

    Show Table button

    Next to the table's title is information about how many features are in the layer.

    Table options

    This layer contains 36 features and the CSV file has addresses for 36 restaurants, so you know that all of the addresses were geocoded.

    A second verification is to check that the addresses were correctly geocoded. To do this, you'll search for a few restaurants and verify their locations on the map. You'll check two of the restaurants shown in the table: Café 222 and The Smoking Goat.

  2. In the search box at the upper right, delete any existing text and start typing Cafe 222.

    Cafe 222

    The address on Island Avenue will be the first one shown in the list.

  3. Click the address for Cafe 222 on Island Avenue.

    Cafe 222 location

    Note that the Search result pop-up and the address you geocoded coincide.

  4. Close the Search result pop-up.
  5. Repeat the steps above for the Smoking Goat, 3408 30th St. San Diego.

    Smoking Goat

    This address was also correctly geocoded. If you want, you can check other restaurant locations.

  6. When you're done, close the table by clicking the X in the upper right corner.

    Close table

  7. Close the Search result pop-up.
  8. In the Contents pane, point to the Restaurants layer. Click the More Options button and choose Zoom to.

    Zoom to

  9. Save the map.

Create a layer for the inspectors' homes

Next, you'll create the layer for the locations of the inspectors' homes.

  1. On the ribbon, click the Add button and choose Add Layer from File.
  2. Browse to and choose the Homes CSV file that you downloaded and saved on your computer.
  3. Click Import Layer.

    Add Homes layer

  4. If necessary, for In, choose United States.
  5. Click Add Layer.

    Inspector homes

    The homes of your four inspectors, Frank, Jessica, Sam, and Sherlock, are now displayed with point symbols of different colors, symbolized using the Name attribute.

  6. Click Options on the Types (Unique symbols) style.

    The marker symbols blend with the map, so you'll create a more distinct contrast between the inspectors' homes and their restaurants.

    Inspector symbols

  7. Click Symbols to change the symbols.

    Symbols change

    You can change the shape, color, and size of the symbols to anything you want. The important thing is to choose options that contrast with the symbols in the Restaurants layer so you can easily identify them on the map.

  8. Click the square shape and increase the symbol size to 12 pixels (px).

    Symbol square

  9. Click OK.
  10. In the Change Style pane, click OK. Click Done to finish changing the symbols.
  11. In the Contents pane, click the Homes layer name to see its legend.

    Inspector legend

    The homes are now clearly distinguishable from the restaurants. In addition, you can tell which inspector lives in which home by the color of the square symbols.

    As chief inspector, you would likely know where your inspectors live, so a visual verification of the map would tell you their addresses were correctly added.

  12. Click the Homes layer name again to close the legend view.
  13. Save the map.

In this lesson, you created the layers that will be used to find the routes. You created a point layer for the Retail Food Monitoring Office using map notes. You also downloaded two CSV files and used them to geocode the addresses for the 36 restaurants and the homes of your four inspectors. In the next section, you'll perform the analysis to find the routes your inspectors will take.


Find the routes and stops

In the previous section, you created layers for the Retail Food Monitoring Office, the homes of your four inspectors, and the restaurants they'll be inspecting. In this lesson, you'll use the Plan Routes analysis tool to determine the most efficient routes connecting your four inspectors with the 36 restaurants. You'll factor into the analysis the time spent at each stop as well as the length of the work day.

Perform the analysis

The Plan Routes tool finds the most efficient routes for a fleet of vehicles making multiple stops. When stops cannot be reached efficiently, the Plan Routes tool creates an unassigned stops layer with an explanation for each stop that can't be reached.

Before you fill in the tool's parameters, keep in mind that you want your inspectors to do the following:

  • Start their work day from home
  • Begin work at approximately 10:00 a.m. to increase the likelihood that restaurant managers will be present when your food inspectors arrive
  • Limit site inspections to 45 minutes per stop
  • Work no longer than 8 hours
  • Report to the Retail Food Monitoring Office at the end of the day

  1. If necessary, open your Routes to Restaurants map.
  2. In the Contents pane, point to the Restaurants layer and click the Perform Analysis button.

    Perform Analysis

  3. In the Perform Analysis pane, click Use Proximity and choose Plan Routes.

    Plan Routes

    Note:
    For more information about the tool or any of its parameters, click the blue information icon to the right of the Plan Routes tool.

    When the tool opens, note that the travel mode for routes defaults to Driving Time.

    Driving Time

  4. For Routes begin at, choose Homes.
  5. For Start time for all routes, choose tomorrow's date.
  6. Set the time to 10:00 AM.

    Start time

  7. For Routes end at, uncheck Return to start and choose Retail Food Monitoring Office (Points).

    This step ensures your inspectors will complete their day at the office.

    Routes end

  8. Set the maximum number of vehicles to route to 4.
  9. Set the maximum number of stops per vehicle to 20.

    Maximum vehicles and stops

    Using a number that is about half the total number of stops will help to balance the workload for your four inspectors.

    Note:

    The Maximum number of stops per vehicle parameter is one of two parameters that balance the overall workload across routes. The other is the Limit the total route time per vehicle parameter. By lowering the maximum number of stops that can be assigned to each vehicle, the vehicles are more likely to have an equal number of stops assigned to them. This helps balance workloads among drivers. The drawback, however, is that it may result in a solution that is less efficient. By increasing the stops per vehicle, the Plan Routes tool has more freedom to find more efficient solutions; however, the workload (in this case, the number of restaurants assigned to a driver) may be unevenly distributed among drivers and vehicles.

  10. Set the time spent at each stop to 45 minutes.

    Time spent

  11. Leave the option to limit the total route time per vehicle at its default setting of 8 hours.

    Limit time

    This will ensure that the routes that are found will only keep your inspectors on the road for 8 hours that day.

  12. Change the result layer name to Inspection Routes, add your name or initials to make it unique within your organization,
    Note:

    Layers created by analysis operations are web services with unique URLs. Adding your name or initials to the results layer name will prevent your layer from conflicting with somebody else's layer in your organization. Once the layer has been created, you can rename it. The unique URL will not change.

  13. Check Include route layers. The route layers allow each inspector to open their own route on a mobile device. Select a folder in which to save the results.
    Note:

    If you plan for your inspectors to use the routes for navigation on their mobile devices, choose a folder that is shared with the inspectors. The folder will contain one Feature Layer, and a Route Layer for each inspector.

    Inspection routes hosted feature layer and route layers in a folder in ArcGIS Online.

  14. Uncheck the Use current map extent box.

    Current map

    Note:

    If the option to use current map extent is checked, only the features visible within the current map extent will be used in the analysis. If unchecked, all features in the input layer will be used, even those outside the current map view.

  15. Click Run Analysis.

    While the Plan Routes tool is running, you may encounter a warning message indicating that some stops won't be assigned to any route. If this occurs, click OK and the tool will complete its processing.

    Warning

    When the analysis is completed, four color-coded routes and their stops are added to the map.

    Analysis map

    Each of the inspection routes will be available to the inspectors to add to their mobile device. Below is an example of Frank's route in Navigator for ArcGIS on a mobile device.

    Inspector Frank's view of his route on his mobile device.

    Note:

    Your unassigned stop, if you have one, may be different than the one in this map. The Plan Routes tool uses historical and real-time traffic data for analysis. This information is updated periodically.

  16. In the Contents pane, point to the Inspection Routes (Your Name) layer, click the More Options button, and choose Rename.
  17. In the Rename window, delete your name, and click OK.
  18. In the same way, rename the other two Inspection Routes layers.

Explore the results

Next, you'll explore the layers that were created with the Plan Routes tool.

  1. In the Contents pane, point to the Inspection Routes - Assigned Stops layer. Click the More Options button and choose Zoom to.
  2. If necessary, to see all the routes, click the Zoom out button one scale level.

    The Contents pane displays six layers, excluding the Topographic basemap.

    Contents

    As new layers are added to the top of the legend, they could be drawn in a way that conceals the map information belonging to the layers below. You can make your map more meaningful by moving layers up or down in the Contents pane to hide or show the information already present in the map. In your map, the Inspection Routes - Assigned Stops layer is obscuring the Homes layer, which contains the starting points for your four food detectives.

  3. In the Contents pane, point to the Homes layer. Click the More Options button and choose Move up.

    Move up

    You can also drag layers to move them up or down.

  4. Click the vertical ellipsis next to the Homes layer and drag the layer below the Retail Food Monitoring Office layer.

    Homes layer

  5. Click the Legend button.

    Legend button

    The legend shows the symbols for the homes, routes, and restaurants. The layer for the Retail Food Monitoring Office, created from a Map Note in the previous lesson, is not included in the legend. (You could add it by clicking the More Options button and choosing Show in Legend.)

    Legend

    In the legend, the red circle is used to symbolize unassigned stops. In the map, that symbol corresponds to a restaurant that exceeded a Plan Routes tool parameter.

  6. Click the red circle to see which restaurant was not assigned to a route. You may need to click the white arrow to see the pop-up with the Violated Constraints field.

    Unassigned stop

    This pop-up explains that this stop was unassigned because including it in the results would have violated the maximum total time of 8 hours for any inspector's route. As a supervisor, you could have it inspected another day or authorize overtime for one inspector.

    You can click any stop or route on the map to learn more about the feature through its pop-ups. The pop-ups contain all the fields created by the Plan Routes tool.

    Note:

    Other Learn ArcGIS lessons that address configuring pop-ups include Get Started with ArcGIS Online and Streamline Deliveries with Drive-Time Analysis.

  7. Click the X in the upper right corner of the pop-up to close it.
  8. Click the Content button to show the map layers.

    Content button

  9. Save the map.

You've completed the analysis and explored the results. The inspectors can load their routes into Navigator for ArcGIS to get narrated turn-by-turn directions as they go about their daily assignments. When they open Navigator for ArcGIS and sign in to your organization, they will be able to load their own route from your analysis results, if you share the routes with them.

In the next section, you'll print the route directions for each of your inspectors.


Print directions for the routes

In the previous section, you performed an analysis to find the most efficient routes and stops for each of your four inspectors. Next, you'll export the route and directions as a new feature layer and as a printable document. The directions will be created from the individual routes within the Assigned Stops layer.

Export a route

You'll select the first route to be exported.

  1. If necessary, open your Routes to Restaurants map.
  2. Point to the Inspection Routes layer and click Expand Legend.

    The legend displays all the four routes. You’ll select a route in the map and open it as a separate layer.

  3. On the map, click on the first route.
  4. In the pop-up click Open Route.

    Route layer pop-up.

    The route opens as a new route layer in the Content pane.

  5. Point to the new layer and click Edit Route .

    Edit route button.

    The Directions pane opens. It lists all the stops along the route and driving directions. You have the option to edit the departure time and date.

  6. Below the route stops, click Save.

    Save button.

  7. For Result layer name, type Route 1. Then click Save.

    The new route layer is now saved to your account and can be accessed on your Content tab.

  8. Click Share the route.

    Share the route button.

    A new tab opens to the route layer’s item details page. You can share this page or click Publish to use it in other maps for further analysis.

  9. Close the tab and return to the map.
  10. Below the route stops, click Print.

    Print button.

    A new window appears with details on driving time and distance, a map, and the specific directions. Below the map, there is also a text box to add notes.

  11. Click Print and choose to either save it to your desktop as a PDF or print it.
  12. Save and close the map.

Congratulations! You've successfully planned the most efficient routes for your four inspectors. The printed directions will give them the information they need so they can start their day without making an unnecessary trip to the main office. If your inspectors need hands-free navigation directions, they can install Navigator for ArcGIS on their mobile devices and load the route layers that you created. For more information on using Navigator for ArcGIS, see the Manage Hydrant Inspections lesson and the Route in Navigator help topic.

In this lesson, you created a layer for the Retail Food Monitoring Office. You downloaded and used two CSV files to create layers by geocoding the addresses for 36 restaurants in San Diego County as well as the homes of your inspectors. You used the Plan Routes analysis tool to produce a map of the most efficient routes. Finally, you exported a set of directions for the route of each of your inspectors.