Exercise 5: Calculating service areas and creating an OD cost matrix

Complexity: Beginner Data Requirement: ArcGIS Tutorial Data for Desktop Data Path: C:\ArcGIS\ArcTutor\Network Analyst\Tutorial Goal: Create service area polygons and create an OD cost matrix.

In this exercise, you will create a series of polygons that represent the distance that can be reached from a facility within a specified amount of time. These polygons are known as service area polygons. You will calculate 3-, 5-, and 10-minute service areas for six warehouses in Paris.

You will also find how many stores are within each of these service areas. You will identify one warehouse that should be relocated to better service the stores. Additionally, you will create an origin–destination cost matrix for delivery of goods from the warehouses to all stores within a 10-minute drive time. Such a matrix is used as an input for logistics, delivery, and routing analyses.

NoteNote:

The data for this exercise and the other exercises in the Network Analyst tutorial is available on ArcGIS.com. After downloading the data, you can extract it wherever you like. It may be helpful, however, to extract it to C:\arcgis\ArcTutor since the tutorial refers to this path as the default location for the data.

Preparing your display

Steps:
  1. If you have Exercise05.mxd open in ArcMap, skip to step 6.
  2. Start ArcMap by clicking Start > All Programs > ArcGIS > ArcMap 10.2.2.
  3. On the ArcMap - Getting Started dialog box, click Existing Maps > Browse for more.
  4. Browse to C:\ArcGIS\ArcTutor\Network Analyst\Tutorial.

    This is the default installation location for the tutorial data.

  5. Double-click Exercise05.mxd.

    The map document opens in ArcMap.

  6. Enable the ArcGIS Network Analyst extension.
    1. Click Customize > Extensions.

      The Extensions dialog box opens.

    2. Check Network Analyst.
    3. Click Close.
  7. If the Network Analyst toolbar is not displayed, you need to add it.

  8. Click Customize > Toolbars > Network Analyst.

    The Network Analyst toolbar is added to ArcMap.

    The Network Analyst toolbar

  9. If the Network Analyst window is not displayed, you need to add it.

  10. On the Network Analyst toolbar, click the Network Analyst window button Network Analyst window.

    The dockable Network Analyst window opens.

    The Network Analyst window

  11. You can dock or undock the Network Analyst window.

Creating the service area analysis layer

Steps:
  1. Click Network Analyst on the Network Analyst toolbar and click New Service Area.

    Choosing New Service Area

    The service area analysis layer is added to the Network Analyst window. The network analysis classes (Facilities, Polygons, Lines, Point Barriers, Line Barriers, and Polygon Barriers) are empty.

    The Network Analyst window with empty classes

    The analysis layer is also added to the Table Of Contents window.

    The service analysis layer shown in the table of contents

Adding facilities

Next, you will add warehouses as facilities for which the service area polygons will be generated.

Steps:
  1. Press CTRL while you drag the Warehouses feature layer from the Table of Contents window and drop it in the Facilities class in the Network Analyst window.

    The six warehouses are loaded as facilities and displayed in the map.

  2. In the Network Analyst window, click the plus (+) sign next to Facilities (6) to see a list of the facilities.

    Facilities listing in the Network Analyst window

Setting up the parameters for the analysis

Next, you will specify that your service area will be calculated based on drive time (using minutes). Three service area polygons will be calculated for each facility, one at 3 minutes, one at 5 minutes, and another at 10 minutes. You will specify that the direction of travel will be from the facility—not toward the facility, that no U-turns are allowed, and that one-way restrictions must be followed.

Steps:
  1. Click the Analysis Layer Properties button on the Network Analyst window.

    Clicking the Layer Properties button

    The Layer Properties dialog box opens.

  2. Click the Analysis Settings tab.
  3. Make sure that Impedance is set to use DriveTime (Minutes).
  4. Type 3 5 10 in the Default Breaks text box.
  5. Under Direction, click Away From Facility.
  6. Choose Not Allowed from the U-Turns at Junctions drop-down list.
  7. Leave Ignore Invalid Locations checked.
  8. Check Oneway in the Restrictions list.
  9. The Analysis Settings tab should now look like this:
    The Analysis Settings tab
  10. Click the Polygon Generation tab.
  11. Make sure that Generate Polygons is checked.
  12. For Polygon Type, click Generalized.

    Detailed polygons are more accurate but need more time to be generated.

  13. Uncheck the Trim Polygon option.

    This is a postprocess that trims the outside polygon to remove spikes but takes a little longer to run.

  14. Click Overlapping for the Multiple Facilities Options.

    This results in individual polygons for each facility. A polygon from one facility might overlap with a polygon from another, nearby facility.

  15. Click Rings for the Overlap type.

    This excludes areas of smaller breaks from the polygons of a bigger break.

  16. Click Apply to save the settings.
  17. Click the Line Generation tab.
  18. Leave Generate Lines unchecked.

    Although you won't generate lines from the edges that are traversed in this exercise, you could by checking this option.

    It is possible to output lines, polygons, or both.

  19. Click OK.

Run the process to compute the service area

Steps:
  1. Click the Solve button Solve on the Network Analyst toolbar.

    The service area polygons appear on the map and on the Network Analyst window.

  2. The polygons are transparent, which allow you to see the underlying streets. However, instead of color coding the breaks from dark to light with increasing distance, you will change them to go from light to dark.
  3. In the Table Of Contents window, right-click the Polygons sublayer and choose Properties.
  4. Click the Symbology tab.
  5. Click the Symbol field name and choose Flip Symbols. (Make sure you click—not right-click—Symbol; otherwise, you won't see a context menu.)

    Clicking Flip Symbols

  6. Click OK.

    The outer and inner service area breaks switch colors, making it clearer what areas the 10-minute breaks cover.

    Map of service area results

Identifying stores that are outside all service areas

Steps:
  1. In the Table Of Contents window, click and drag Stores to the top of the Layers list to improve visibility.

    The Table Of Contents

  2. Click Selection > Select By Location.

    Choosing Select By Location

  3. Create the selection query on the Select By Location dialog box to select features from stores that are completely within polygons, as shown below.

    Select By Location

  4. Click OK.

    The stores that are within the polygons are selected; however, you want to select the stores that are outside the service area polygons.

  5. In the Table Of Contents window, right-click Stores and click Selection > Switch Selection.

    The selection now shows the distribution of stores not contained in any service area polygons. Use this selection to identify the area in which you will relocate a warehouse. The best area appears to be in the center of the map.

    Stores outside all service areas

  6. On the Tools toolbar, click the Clear Selected Features button Clear Selected Features.

Relocating the least accessible warehouse

Look at the service area polygons of Warehouse #2. There are not any stores within the 3-, 5-, or 10-minute service areas around Warehouse #2; hence, you will relocate that warehouse to better service the stores.

Steps:
  1. On the Network Analyst window, select Warehouse #2 under Facilities (6).

    Selecting Warehouse #2

  2. Click the Select/Move Network Location Tool Select/Move Network Locations Tool on the Network Analyst toolbar.
  3. On the map display, drag Warehouse #2 to the center of the map as shown below.

    Relocating Warehouse #2

Run the process to compute the service area

Steps:
  1. Click the Solve button Solve on the Network Analyst toolbar.

    The service area polygons appear on the map and the Network Analyst window.

Identifying the service area polygon that each store is within

Steps:
  1. In the Table Of Contents window, right-click Stores and click Joins and Relates > Join.

    Choosing Join from the context menu

    The Join Data dialog box opens.

  2. Choose Join data from another layer based on spatial location.

    Choosing to join based on spatial location

  3. Choose Polygons as the layer to join to this layer.

    Choosing to join Polygons to this layer

  4. Click the it falls inside button.

    Choosing the "it falls inside" option

    This adds the attributes of the polygon to all points that fall inside the polygon.

  5. Specify an output shapefile or feature class to save the join results to and name it StoresWithPoly.

    Setting the output shapefile or feature class

  6. Click OK.

    ArcGIS performs the join and adds the new layer to the map document.

  7. In the Table Of Contents window, right-click the new StoresWithPoly feature layer and choose Open Attribute Table.

    Each row in the table displays the name of the store and polygon it falls under. You can use this table to generate other useful categories, such as the number of stores within 0-to 3-minute service areas.

  8. Close the attribute table.
  9. You can optionally export your facilities (including the one you moved) as a feature class.
  10. In the Network Analyst window, right-click Facilities (6) and choose Export Data.

    The Export Data dialog box opens.

  11. In the Export drop-down list, choose All features.
  12. Choose an output location and type (shapefile or feature class).

    You might choose to store a feature class in the Paris geodatabase: C:\arcgis\ArcTutor\Network Analyst\Tutorial\Paris.gdb\New_Warehouses

    The Export Data dialog box

  13. Click OK.

    A message appears asking if you want to add the exported data to the map.

  14. Click No.

    You won't need the data for the rest of this exercise.

Creating an OD cost matrix analysis layer

Optionally, you can create an origin–destination cost matrix for deliveries from the new warehouses to each store. The results of this matrix can be used to identify stores that will be serviced by each warehouse within a 10-minute drive time. Also, you can find the total drive time from each warehouse to its stores.

Steps:
  1. In the Table Of Contents window, uncheck the Service Area analysis layer and the StoresWithPoly feature layer to improve readability of the map.
  2. Click Network Analyst on the Network Analyst toolbar and click New OD Cost Matrix.

    Choosing New OD Cost Matrix

    The OD cost matrix analysis layer is added to the Network Analyst window. The network analysis classes (Origins, Destinations, Lines, Point Barriers, Line Barriers, and Polygon Barriers) are empty.

    The Network Analyst window with empty classes

    The analysis layer is also added to the Table Of Contents window.

    The OD cost matrix analysis layer shown in the table of contents

Adding origins

You can use the facilities from the service area analysis (in the previous sections) as origins. If you have not completed the section on service areas, you can use the Warehouses feature layer instead.

Steps:
  1. In the Network Analyst window, right-click Origins (0) and choose Load Locations.

    The Load Locations dialog box opens.

  2. Click ServiceArea/Facilities in the Load From drop-down list. (If you did not complete the previous sections on service area analysis, you can choose Warehouses instead.)
  3. Uncheck Only load selected rows.
  4. Under Location Position, click Use Network Location Fields. (If you are loading Warehouses, click Use Geometry.)

    Using network location fields allows ArcGIS to use the already-located position of service area facilities to locate them again as origins. This is much faster than using a spatial search to locate them again.

    The Load Locations dialog box

  5. Click OK.

    The six new origins are displayed on the map and listed in the Network Analyst window under Origins.

    Origins listed in the Network Analyst window

Adding destinations

Steps:
  1. In the Network Analyst window, right-click Destinations (0) and choose Load Locations.
  2. Choose Stores in the Load From drop-down list.
  3. Under Location Analysis Properties, for the property name, choose NOM from the Field drop-down list.

    Since the French field name NOM is not configured in the NASolverConfiguration.xml file, ArcGIS is unable to map the field name automatically.

    The Load Locations dialog box

  4. Click OK.

    The Network Analyst window now lists 21 destinations.

    Destinations listed in the Network Analyst window

    These destinations are also displayed on the map.

    Origins and destinations shown in the map display

Setting up the parameters for the analysis

Next, you will specify that your OD cost matrix will be calculated based on drive time. You will set a default cutoff value of 10 minutes and ensure that all destinations are found within the specified cutoff. Additionally, you will specify that U-turns are allowed everywhere and the output Shape type should be a straight line. Since all these trips are on roads, one-way restrictions must be followed. All invalid locations (locations not found) will be ignored.

Steps:
  1. Click the Analysis Layer Properties button on the Network Analyst window.

    Clicking the Analysis Layer Properties button

  2. Click the Analysis Settings tab.
  3. Make sure that the Impedance drop-down list is set to DriveTime (Minutes).
  4. Leave Use Start Time unchecked.
  5. Type 10 in the Default Cutoff Value text box.

    This will create origin–destination paths from each warehouse to all stores that can be reached within 10 minutes. Minutes are the units since the impedance attribute is in minutes.

  6. Make sure that Destinations To Find is set to <All>.
  7. Click the U-Turns at Junctions drop-down arrow and choose Allowed.
  8. Make sure that Output Shape Type is set to Straight Line.
  9. Make sure that Ignore Invalid Locations is checked.
  10. Check Oneway in the Restrictions list.

    The Analysis Settings tab of the Layer Properties dialog box

  11. Click OK.

    The parameter settings are saved.

Run the process to create the OD cost matrix

Steps:
  1. Click the Solve button Solve on the Network Analyst toolbar.

    The OD lines appear on the map. There are 24 lines in this example. This number may be different for you, depending on where you relocated Warehouse #2.

  2. If the Service Area layer is not displayed, turn it on to show the OD Cost Matrix layer on top of the service areas of the warehouses.

Allocating stores to warehouses

Based on the OD cost matrix, you can now identify the stores that would be served by each warehouse.

Steps:
  1. In the Network Analyst window, right-click Lines (24) and choose Open Attribute Table.

    Opening the Lines table

    The Lines table opens.

  2. The Lines table represents the origin–destination cost matrix from each warehouse to the stores within a 10-minute drive time. The OriginID column contains IDs of warehouses. The DestinationID column contains IDs of stores. The DestinationRank is a rank assigned to each destination that is served by a store based on the total drive time. For example, in the table below, for Warehouse #1, DestinationID 2 has a rank of 1, and DestinationID 3 has a rank of 2. This is because it takes less time to go from Warehouse #1 to DestinationID 2. (This may be different for you, as your analysis results are dependent on the source feature class of the origins and destinations.)

    The Lines table

    The OD cost matrix displays the stores serviced by each warehouse along with the total drive time for each route. Some stores are within a 10-minute accessibility zone of more than one warehouse and can be served by any one of them. The OD cost matrix can also be used as an input in logistics routing models that use origin–destination matrices to allocate goods and services.

  3. If you don't plan to work on any other exercise, exit ArcMap. Click No to discard any changes.
  4. If you plan to work on another exercise, follow the substeps below.
    1. Click File > New.

      The New Document dialog box opens.

    2. Click OK.
    3. Click No when prompted to save changes.
3/25/2015