Skip To Content

Closest facility analysis layer

The closest facility solver measures the cost of traveling between incidents and facilities and determines which are nearest to one other. When finding closest facilities, you can specify how many to find and whether the direction of travel is toward or away from them. The closest facility solver displays the best routes between incidents and facilities, reports their travel costs, and returns driving directions.

When finding the closest facility, you can specify constraints, such as a cutoff cost beyond which Network Analyst will not search for facilities. For instance, you can set up a closest facility problem to search for hospitals within a 15-minute drive of the site of an accident. Any hospitals that take longer than 15 minutes to reach are not included in the results. In this example, the hospitals are facilities, and the accident is the incident. Network Analyst allows you to perform multiple closest facility analyses simultaneously. This means you can have multiple incidents and find the closest facility (or facilities) for each incident.

Tip:

The closest facility and OD cost matrix solvers perform very similar analyses; the main difference, however, is in the output and the computation speed. OD cost matrix generates results more quickly but cannot return the true shapes of routes or their driving directions. It is designed to quickly solve large M x N problems and, as a result, does not internally contain the information required to generate route shapes and driving directions. Alternatively, the closest facility solver returns routes and directions but performs the analysis more slowly than the OD cost matrix solver. If you need driving directions or true shapes of routes, use the closest facility solver; otherwise, use the OD cost matrix solver to reduce the computation time.

This topic describes the closest facility analysis layer, its analysis properties, and its feature classes.

Facilities feature class

This network analysis class stores the network locations that are used as the starting or ending points in closest facility analyses.

When a new closest facility analysis layer is created, the Facilities class is empty. It is populated only when network locations are added into it. A minimum of one facility and one incident are necessary to solve the analysis.

Facilities: Input fields

Input fieldDescription

ObjectID

The system-managed ID field.

Shape

The geometry field indicating the geographic location of the network analysis object.

Name

The name of the network analysis object.

Attr_[Cost]

(for instance, Attr_DriveTime, where DriveTime is the travel cost)

This property stores an extra cost for the network location.

Take the example of finding the three closest fire stations to a fire incident using DriveTime as the impedance. Attr_DriveTime can store the turnout time for the facility. Turnout time is how long it takes a crew to put on the appropriate protective equipment and exit the fire station.

Cutoff_[Cost]

(for instance Cutoff_DriveTime, where DriveTime is the travel cost)

While searching for the closest incident from a facility, Network Analyst can use a cutoff value for the impedance. Any incident beyond the cutoff value will not be searched.

If the Cutoff_[Cost] is not set for a facility, the analysis will use the default cutoff value specified on the Closest Facility tab for this analysis layer. If a default cutoff value is not set there either, the closest incident will be found, regardless of how far it may be.

Network location fields

  • SourceID
  • SourceOID
  • PosAlong
  • SideOfEdge
  • SnapX
  • SnapY
  • SnapZ
  • DistanceToNetworkInMeters

Together, these properties describe the point on the network where the object is located.

CurbApproach

This property lets you specify which side of the vehicle you want the facility to be on when the vehicle arrives or departs. You can use the Right side of vehicle (1) or Left side of vehicle (2) value for any analysis that requires the vehicle to arrive or depart a facility from one side only. If the arrival or departure is permitted from either side of a vehicle, use the default value Either side of vehicle (0).

For closest facility analyses, the No U-turn (3) value functions the same as Either side of vehicle.

Facilities: Input/output fields

Input/output fieldDescription

Status

This field is constrained by a domain of values, which are listed below (their coded values are shown in parentheses).

  • OK (0)—The facility is valid.
  • Not located (1)—The facility location on the network dataset can't be determined.
  • Network element not located (2)—The network element identified by the facility network location fields can't be found. This can occur when a network element where the facility should be was deleted, and the network location was not recalculated.

After running the analysis, the status can be modified to one of the following status values:

  • OK (0)—The network location was successfully evaluated.
  • Element not traversable (3)—The network element that the facility is on is not traversable. This can occur when the network element is restricted by a restriction attribute.
  • Invalid field values (4)—One or more of the facility field values fall outside the analysis layer's coded or range domains. For example, a negative number may exist where positive numbers are required.
  • Not reached (5)—The facility can't be reached by the solver.
  • Not located on closest (7)—The closest network location to the facility is not traversable because of a restriction or barrier, so the facility has been located on the closest traversable network feature instead.

Incidents feature class

This network analysis class stores the network locations that are used as starting or ending points in closest facility analyses. Whether starting or ending points, incidents are always on the opposite end of a route from the connected facility.

When a new closest facility analysis layer is created, the Incidents class is empty. It is populated only when network locations are added into it. A minimum of one facility and one incident are necessary to solve the analysis.

Incidents: Input fields

Input fieldDescription

ObjectID

The system-managed ID field.

Shape

The geometry field indicating the geographic location of the network analysis object.

Name

The name of the network analysis object.

TargetFacilityCount

This property stores the number of facilities that need to be found for the incident.

A default value for the number of facilities to find can be set on the Closest Facility tab for this analysis layer. Values specified in the TargetFacilityCount field will override that default value.

Attr_[Cost]

(for instance, Attr_DriveTime, where DriveTime is the travel cost)

This property stores an extra cost for the network location.

For example, if you're finding the three closest fire stations from a fire incident using DriveTime as impedance, the property Attr_DriveTime can store the amount of time spent at the fire incident. This could be the time it takes for firefighters to hook up their equipment and begin fighting the fire.

Cutoff_[Cost]

(for instance Cutoff_DriveTime, where DriveTime is the travel cost)

This cutoff value indicates the farthest network distance to search for a facility. Any incident farther from the facility than the cutoff value will not be searched or included in the results.

A default value for the cost cutoff can be set on the Closest Facility tab for this analysis layer. Values specified in the Cutoff__[Cost] field will override that default value. If the default cutoff value is also not set, the closest facility will be found, regardless of how far it may be.

Network location fields

  • SourceID
  • SourceOID
  • PosAlong
  • SideOfEdge
  • SnapX
  • SnapY
  • SnapZ
  • DistanceToNetworkInMeters

Together, these properties describe the point on the network where the object is located.

CurbApproach

This property lets you specify which side of the vehicle you want the incident to be on when the vehicle arrives or departs. You can use the Right side of vehicle (1) or Left side of vehicle (2) value for any analysis that requires the vehicle to arrive or depart an incident from one side only. If the arrival or departure is permitted from either side of a vehicle, use the default value Either side of vehicle (0).

For closest facility analyses, the No U-turn (3) value functions the same as Either side of vehicle.

Incidents: Input/output fields

Input/Output fieldDescription

Status

This field is constrained by a domain of values, which are listed below (their coded values are shown in parentheses).

  • OK (0)—The facility is valid.
  • Not located (1)—The facility location on the network dataset can't be determined.
  • Network element not located (2)—The network element identified by the facility network location fields can't be found. This can occur when a network element where the facility should be was deleted, and the network location was not recalculated.

After running the analysis, the status can be modified to one of the following status values:

  • OK (0)—The network location was successfully evaluated.
  • Element not traversable (3)—The network element that the facility is on is not traversable. This can occur when the network element is restricted by a restriction attribute.
  • Invalid field values (4)—One or more of the facility field values fall outside the analysis layer's coded or range domains. For example, a negative number may exist where positive numbers are required.
  • Not reached (5)—The facility can't be reached by the solver.
  • Not located on closest (7)—The closest network location to the facility is not traversable because of a restriction or barrier, so the facility has been located on the closest traversable network feature instead.

Routes feature class

The Routes class stores the resulting route, or routes, of the analysis. It is an output-only class; the closest facility analysis layer overwrites or deletes any route features while running the analysis

Routes: Output fields

Output fieldDescription

ObjectID

The system-managed ID field.

Shape

The geometry field indicating the geographic location of the network analysis object.

Name

The name of the closest facility route is based on the names of the associated facility and incident.

The facility name is first if the direction of travel is from the facility to the incident. For example, Facility 5–Incident 3 indicates the route travels from Facility 5 to Incident 3. The incident name is first if the direction of travel is from the incident to the facility.

FacilityID

The unique ID of the facility the route visits.

FacilityRank

The rank of the facility among all facilities found for the associated incident; the closest facility has a rank of 1.

IncidentCurbApproach

Describes the side of the vehicle the incident is on when arriving at or departing from the incident. A value of 1 means the right side of the vehicle; a value of 2 indicates the left side.

FacilityCurbApproach

Describes the side of the vehicle the facility is on when arriving at or departing from the facility. A value of 1 means the right side of the vehicle; a value of 2 indicates the left side.

IncidentID

The unique ID of the incident the route visits.

Total_[Cost]

(for instance Total_Minutes, where Minutes is the travel cost)

The cumulative cost of the route between the facility and the incident. This field is generated for the impedance attribute and any accumulated attributes.

StartTime

The start time of the route, reported as local time at the first stop.

EndTime

The end time of the route, reported as local time at the last stop.

StartTimeUTC

The start time of the route in Coordinated Universal Time (UTC).

EndTimeUTC

The end time of the route in Coordinated Universal Time (UTC).

Closest facility analysis layer properties

The following subsections list parameters you can set on the analysis layer. They are found on the Closest Facility tab, which is available only if your Closest Facility layer or one of its sublayers is selected in the Contents pane.

Closest Facility tab

Run

After you load input features and set analysis properties, click Run Run to solve the closest facility analysis.

Import Facilities

Import Facilities Import Facilities is in the Input Data group. Click it to load features from another data source, such as a point feature layer, into the Facilities feature class.

Import Incidents

Import Incidents Import Incidents is in the Input Data group. Click it to load features from another data source, such as a point feature layer, into the Incidents feature class.

Import Barriers

Import Barriers Import Barriers is in the Input Data group. Click it to load features from another data source, such as another feature layer, into one of the barriers feature classes (point barriers, line barriers, polygon barriers).

Mode

The Mode drop-down list lets you choose a travel mode, which is a group of settings that together model the movement of pedestrians, cars, trucks, or other travel mode. The choices available in the drop-down list depend on the travel modes that are configured on the network data source that the network analysis layer is referencing.

Direction

Your closest facility analysis can accumulate travel time or other cost in the direction away from or toward the facility.

  • Away from Facility—The direction of travel is from the facility to the incident.
    Away from facility
  • Towards Facility—The direction of travel is from the incident to the facility.
    Towards facility

On a network with one-way restrictions and different travel times based on direction of travel, changing the travel direction can produce different results. The direction you should choose depends on the nature of your analysis. For example, to route the closest fire truck (the facility) to the location of a fire (the incident), the Away from Facilities option would be the most appropriate choice. Alternatively, identify the closest gas station (facility) to your current location, Towards Facilities would be a better choice because you need to travel to the facility.

Cutoff

When calculating the least-cost path from an incident to facility, the Closest Facility solver will stop searching for facilities that lie beyond this impedance cutoff. No facilities beyond this limit will be found for that incident. The units you use for the cutoff value are shown next to the Mode drop-down list.

Note:

Cutoff assigns default values to origins that do not have numeric values stored in the Cutoff_[Cost] field.

Facilities

You can specify the number of facilities to find per incident by entering a value for Facilities.

Note:

The value in Facilities can be overridden on a per-incident basis by specifying an individual value for the TargetFacilityCount property in the incidents sublayer.

Type

The Type drop-down list is in the Arrive/Depart Time group and is enabled when the cost units are time based. It allows you to choose how to enter a time value. The main reason for setting a specific time and date is to solve the analysis using dynamic traffic conditions, such as from live and predicted traffic flows, if your network data source incorporates that information.

  • Not Using Time —Regardless of whether the network data source includes traffic data, the results are based on static travel times—the travel times on a street don't fluctuate throughout the day. The Time and Date text boxes are disabled.

  • Custom Time & Date —You specify the time as a time of day and calendar date. The Time and Date text boxes are enabled for you to enter this information.

  • Today —You specify a time, and the day is assumed to be the current date. The Time text box is enabled for you to enter the time of day, and the Date text box is set to Today and is disabled so it can't be changed.

  • Current Date & Time —When you run the analysis, the time and date are set to the current time and date. This is useful if your network data source is configured with traffic data and you need to know what areas can be reached if drivers departed now. The Time text box is set to Now, and the Date text box is set to Today; both are disabled so they can't be changed.

  • Day of Week —You specify a time of day and day of the week. The Time and Date text boxes are enabled for you to enter this information. Set the day of the week by typing one of the following values into the Date text box:

    • Sunday
    • Monday
    • Tuesday
    • Wednesday
    • Thursday
    • Friday
    • Saturday

Time Usage

You can choose the specified date and time to be either the departure time or arrival time.

Time Usage: Departure —Represents the date and time you want the closest facility routes to start.

Time Usage: Arrival —Represents the date and time you want the closest facility routes to finish.

Output Geometry Linear Shape Type

This control allows you to choose how the output will display in the map. The closest facility analysis will always solve least-cost paths along the network using the settings you specify, but in addition to displaying these true paths along the network on the map, you can also choose to represent the routes on a map using simple straight lines between incidents and facilities or no lines at all.

Directions

Directions Directions is in the Reports group. Click it to generate turn-by-turn directions for each route in the solution.

Share as Route Layers

The Route Layers button Share As Route Layer in the Share As group allows you to share the results from the analysis as route layers. This button opens the Share as Route Layers geoprocessing tool. Upon successful execution, the results from the analysis are shared as route layer items in the portal.