Find the distance to assets from bases

Have you ever needed to know the distance from central hub locations, such as bases or offices, to groups of related assets, such as equipment or workers?  This blog post outlines a workflow and some tools for solving this type of problem, starting from two simple text files of bases and assets.  In the workflow you’ll geocode the text files to get point locations, make back-up copies of the points, use a road network to find the shortest route from each asset to its related base, and finally summarize the distance data for each base. The resulting data will look like this:

All routes symbolized by base

This kind of analysis is useful for understanding some of the impacts of relocating an office, identifying monetary reimbursement values for relocated service members, or determining whether equipment needs to be reassigned to another headquarters.

What you’ll need:

1. An “Asset” text file.  This should be a comma separated value (CSV) table that contains the asset name or ID, the address or MGRS locations of the asset, and the base or office to which the asset belongs. If you use MGRS locations they must be on a network route, or specify a large snapping distance in the “Add Locations” in the “Route from Assets to Bases” model. Here’s an example of such a table:

Asset text file schema

A sample Asset text file is included with the Distance to Assets template. This CSV file contains six fields:  Name, Street, City, State, ZIP, Country, and Base.

Sample Assets File

Note that all of the names are fictional, and the addresses were created by reverse-geocoding a set of random points.

2. One “Base” text file. This should be a CSV table that contains the Base address and Base name. The values in the Base field should match the spelling of the Base values in the Asset text file. Here’s an example:

Bases text file schema

A sample Base text file is included with the Distance to Assets template. This CSV file contains five fields: Base, Street, City, State, and Zip.

Bases text file

The base names included in this table must exactly match the base names in the Assets table.

3. An Address Locator (sometimes called a “geocoder”).  You can use an Address Locator that you create to work with your own street network data, or you can use the World Geocoding Service which is available to ArcGIS Online organizational subscribers.

4. A street network dataset. You can use the Find Closest Facility ArcGIS Online logistics service, available to ArcGIS Online organizational subscribers, or you can use your own street network data. If you use local data you will need the ArcGIS Network Analyst extension installed on your computer.

Getting Started:

1. Download the template, with the sample data and map.
2. Extract the zip file to a folder on your machine. The project folder contains a geodatabase, a layers folder, a sample locations folder, a map document, and a toolbox.
3. Open the DistanceToAssets.mxd map document. The map will open with the OpenStreetMap basemap over the United States.
4. Open the Catalog window in ArcMap so you can see the Distance to Assets toolbox.

Each of the model tools is prefixed with a number to indicate the order in which they should be run.  For the Routing step there is an a or b variant of the model that you can choose to use, depending on whether you are  using local network and address matching or ArcGIS Online services.

Distance to assets folder contents

Step 1: Create point features from your assets and bases tables

The first step is to turn your CSV files into point feature classes by geocoding the addresses. The 1 Geocode Assets and Bases model will do this. If you have an ArcGIS Online Organization account, you can log in to ArcGIS Online from ArcMap (from the File menu click Sign In) and use the ArcGIS Online geocoder. If you have a local set of streets data and an address locator, you can use the local geocoder.

1. If you have an ArcGIS Online Organization account and you want to use the In the Catalog window, under GIS Servers, double-click the Add ArcGIS Server.
2. Accept the option to Use GIS Services and click Next.
3. Set the Server URL to https://geocode.arcgis.com/arcgis/services
4. Click Finish.
5. On the Geocoding toolbar, click the dropdown list and click Manage Address Locators.
6. If you are signed in to ArcGIS Online, the World Geocode Service (ArcGIS Online) should be active (it will have an asterisk beside it). If you want to use another address locator, click the Add button, navigate to the locator and make it active. Close the Address Locator Manager dialog box.
7. Run the 1 Geocode Assets and Bases model.
8. Specify an address locator, such as the World Gecoding Service available with an ArcGIS Online subscription, or a local one configured to work with your street data. See the web help for more information about finding the location of addresses.
9. Specify the Assets input address (or MGRS) table. You can use the sample Assets.csv file, included in the Sample Locations folder.

10. Choose the input location fields for the assets table. You need to match the fields the geocoder expects to the fields in your data (the sample data should match the Street_Addresses_US address locator and the ArcGIS Online World Geocoding Service automatically).

11. Choose an output location for your geocoded assets data. The output will be a feature class.
12. Set the corresponding inputs for the bases.
13. Click OK to run the model.

Geocode Assets And Bases dialog box

When the model finishes you will have two new feature classes, AssetsGeocoded and BasesGeocoded.

Geocoded bases and assets sample map

Some of the addresses may not have exact matches.  If they don’t, they’ll appear in the AssetsNotGeocoded and BasesNotGeocoded feature class tables with a “U” in the status column, and there will be no point feature to represent them. You can fix this by using the Review/Rematch Addresses tool on the Geocoding Toolbar in ArcGIS for Desktop to refine your results. For more information about reviewing and re-matching addresses, see the ArcGIS Help.

Step 2: Make a backup copy of your assets and bases data

Geocoding tables of addresses sometimes results in unmatched features. Manually re-matching these may take some time.  The next step is to make a back-up (or “Gold”) copy of your data.  Having this copy will preserve the investment you made in geocoding and re-matching the addresses. You can use these feature classes for other analyses later.

1. Run the 2 Copy Geocoded Locations model. This model is optional.
2. Specify the Input Assets Features. This should be the output assets of the Geocode Assets and Bases model.
3. Specify the output location of the Gold Copy of the Assets feature class.
4. Repeat steps 2 and 3 for the Bases feature class.
5. Click OK to run the model.

The model runs, making clean backup copies of your assets and bases feature classes.

Step 3: Route from assets to bases

The third step is to build routes from the assets to their respective bases.  There are several ways to approach this problem, but this tool uses the “Closest Facility” network solver.  Since some assets may be closer to a base other than the one with which they are associated, the model iterates through the Base values in the BasesGeocoded feature class and repeats the analysis for the just the assets that belong to each base. The output of the model is a set of feature classes, one for each base, that contain the shortest drive time routes from each asset to its base. There are two versions of the “Route from Assets to Bases” tool, one for locally hosted network data and the other for ArcGIS Online data.

To run the model:

1. Run the Route from Assets to Bases tool for Local or ArcGIS Online network data.
2. If you run the tool for Local Network data, specify the input Analysis Network.
3. Specify the input Base Geocoded features.
4. Specify the input Assets Geocoded features.
5. Click OK to run the model.

Route Assets To Bases Tool

If you use the 3b Route from Assets to Bases ArcGIS Online tool, you will need to be logged in to ArcGIS Online from within ArcMap, and you will need to edit the model and save your changes to it after you have logged in. Run this tool from the Model Diagram window.
If you use the local data version of this tool, it will run faster if you have copied the network data to a file geodatabase on a hard drive of the computer you are using to run the analysis, rather than running the solver on data stored on a DVD.

The resulting feature classes will be added to the Distance to Assets geodatabase. They will not be added to the map by default, although you can add them if you wish to. They are called Assets_to_Base_n, one for each base in the BasesGeocoded feature class.

Step 4: Summarize the distance data for each base

After you run the Route from Assets to Bases tool there will be a set of feature classes named “Assets_to_Base_n” for each base and its associated assets. The final step is to consolidate these feature classes into a single feature class and summarize the travel distance information for each base.

Geodatabase with intermediate results

1. Run the 4 Summarize Results tool.
2. Specify the merged output feature class (the default name is Assets_to_Base_All).
3. Specify the Working geodatabase.
4. Specify the output statistics table location and name.

Summarize results tool dialog box

The Assets_to_Base_All feature class and the summary statistics table are added to the map.

Assets to Base All on map

Each route in the output feature class retains the base it is connected to, so you can symbolize or calculate your own statistics by base.

By John Fry and Bob Booth

This entry was posted in Defense and tagged , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply