Closest facility analysis

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.

Finding the nearest police cruisers to incidents

When finding the closest facility, you can specify constraints, like 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 performing multiple closest facility analyses simultaneously. This means you can have multiple incidents and find the closest facility (or facilities) for each incident.

TipTip:

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.

Finding the closest facility to an incident follows the same workflow as other network analyses.

Learn more about the network analysis workflow

Closest facility analysis layer

The closest facility analysis layer stores all the inputs, parameters, and results of a closest facility analysis.

Creating a closest facility analysis layer

You can create a closest facility analysis layer from the Network Analyst toolbar by clicking Network Analyst > New Closest Facility.

The Network Analyst toolbar

When you create a new closest facility analysis layer, it appears in the Network Analyst window, along with its six network analysis classes: Facilities, Incidents, Routes, Point Barriers, Line Barriers, and Polygon Barriers.

Network Analyst window

The closest facility analysis layer also appears in the Table of Contents window as a composite layer, which is named Closest Facility, or if a closest facility with the same name already exists in the map document, such as Closest Facility 1, Closest Facility 2, and so on. There are six feature layers: Facilities, Incidents, Routes, Point Barriers, Line Barriers, and Polygon Barriers. Each of the six feature layers has default symbology that can be modified on its Layer Properties dialog box.

Table of contents

Closest facility analysis classes

The closest facility analysis layer is composed of six network analysis classes.

Learn more about network analysis classes

An overview of each class and descriptions of their properties are provided in the following sections.

Facilities 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 is necessary to solve the analysis.

Facility properties

Input properties of facilities

Input field

Description

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_[Impedance]

(for instance, Attr_Minutes, where Minutes is the impedance for the network)

This property stores the value of impedance 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 don the appropriate protective equipment and exit the fire station.

Cutoff_[Impedance]

(for instance, Cutoff_DriveTime, where DriveTime is the impedance for the network)

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 Cutoff_[Impedance] is not set for a facility, the closest facility analysis will use the Default Cutoff Value, which you specify in the analysis settings on the Layer Properties dialog box. If Default Cutoff Value is set to <None>, then the closest incident will be found, regardless of how far it may be.

Network location fields

  • SourceID
  • SourceOID
  • PosAlong
  • SideOfEdge

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

Learn more about network location fields

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) values for any analysis that requires the vehicle to arrive/depart a facility from one side only. If the arrival/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.

Learn more about U-turn policies

Input/Output fields of facilities

Input/output field

Description

Status

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

  • OK (0)—The network location is valid.
  • Not located (1)—The location on the network can't be determined.
  • Network element not located (2)—The network element that the network location is supposed to be on can't be found. This can occur when a network edge is deleted and the network location is not recalculated.

After a solve operation, the status can be modified using one of the following status values:

  • OK (0)—The network location was successfully evaluated.
  • Element not traversable (3)—The network element that the network location is on is not traversable. This can occur when the network element is restricted by a restriction attribute.
  • Invalid field values (4)—The field values of the network location 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 network location can't be arrived at by the solver.

Incidents 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 is necessary to solve the analysis.

Incident properties

Input fields of incidents

Input field

Description

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.

If this property is set to a value other than <Null>, the number of facilities to find for the analysis layer is overridden. The analysis layer property it overrides is Facilities To Find, which is found on the Analysis Settings tab of the Layer Properties dialog box.

Attr_[Impedance]

(for instance, Attr_Minutes, where Minutes is the impedance for the network)

This property stores the value of impedance for the network location.

For example, if you are 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_[Impedance]

(for instance, Cutoff_DriveTime, where DriveTime is the impedance for the network)

While searching for the closest facility from an incident, you can enter an impedance value. Any incident beyond the cutoff value will not be searched nor included in the results.

If Cutoff_[Impedance] is not set for a facility, the closest facility analysis will use the default cutoff value set on the Analysis Settings tab of the Layer Properties dialog box. If the default cutoff value is also not set, the closest incident will be found, regardless of how far it may be.

Network location fields

  • SourceID
  • SourceOID
  • PosAlong
  • SideOfEdge

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

Learn more about network location fields

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) values for any analysis that requires the vehicle to arrive/depart an incident from one side only. If the arrival/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.

Learn more about U-turn policies

Input/Output fields of incidents

Input/Output field

Description

Status

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

  • OK (0)—The network location is valid.
  • Not located (1)—The location on the network can't be determined.
  • Network element not located (2)—The network element that the network location is supposed to be on can't be found. This can occur when a network edge is deleted and the network location is not recalculated.

After a solve operation, the status can be modified using one of the following status values:

  • OK (0)—The network location was successfully evaluated.
  • Element not traversable (3)—The network element that the network location is on is not traversable. This can occur when the network element is restricted by a restriction attribute.
  • Invalid field values (4)—The field values of the network location 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 network location can't be arrived at by the solver.

Routes class

The Route class stores the resulting route, or routes, of the analysis. As with other feature layers, its symbology can be accessed and altered from its Layer Properties dialog box.

The Route class is an output-only class; it is empty until the analysis is complete. Once the closest facilities are found, the routes are displayed on the Network Analyst window.

Route properties

Output fields of routes

Output field

Description

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 Facility to Incident is the selected Travel From analysis layer setting. For example, Facility 5—Incident 3 indicates the route travels from Facility 5 to Incident 3.

If Incident to Facility is selected, the incident name is first; for instance, Incident 3—Facility 5.

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 vehicle; 2 indicates the left side.

IncidentID

The unique ID of the incident the route visits.

Total_[Impedance]

(for instance, Total_Minutes, where Minutes is the impedance for the network)

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

Point, line, and polygon barriers

Barriers serve to temporarily restrict, add impedance to, and scale impedance on parts of the network. When a new network analysis layer is created, the barrier classes are empty. They are populated only when you add objects into them—but adding barriers is not required.

Barriers are available in all network analysis layers; therefore, they are described in a separate topic.

Learn more about barriers

Closest facility analysis parameters

Analysis parameters are set on the Layer Properties dialog box for the analysis layer. The dialog box can be accessed in different ways:

Learn more about opening the network analysis Layer Properties dialog box

The Analysis Settings tab

The Analysis Settings tab

The following subsections list parameters that you can set on the analysis layer. They are found on the Analysis Settings tab of the analysis layer's Layer Properties dialog box.

Impedance

Any cost attribute can be chosen as the impedance, which is minimized while determining the route. For instance, choosing the Minutes attribute results in the quickest route to the closest facility.

By choosing a traffic-enabled cost attribute and specifying a time of day and date under Use Time, the closest facility analysis accounts for variable traffic speeds for that time and date.

Learn more about cost attributes

Restrictions

You can choose which restriction attributes should be respected while solving the analysis. In most cases, restrictions cause roads to be prohibited, but they can also cause them to be avoided or preferred. A restriction attribute, such as Oneway, should be used when finding solutions for vehicles that must obey one-way streets (for instance, nonemergency vehicles). Other common restriction attributes include height or weight limits that prohibit some vehicles from traversing certain roads or bridges; hazardous materials restrictions that hazmat drivers need to completely bypass or at least try to avoid; and designated truck routes that truck drivers should try to follow. You can choose which restriction attributes should be respected while solving the analysis. (You can further specify whether the elements that use the restriction should be prohibited, avoided, or preferred in the Attribute Parameters tab.)

Use Time

Use Start Time, in conjunction with the Usage, Time of Day, and Day of Week or Specific Date properties, lets you specify when the routes start or end.

Note that specifying a start time doesn't require a traffic-enabled cost attribute; yet, if the network dataset includes traffic data, the results of the analysis are more accurate. That is, the results are calculated for the time and date that you set. For example, during rush hour, the routes could take longer than during off-peak hours. Furthermore, the best paths could change depending on traffic conditions at that time.

Usage

The time and date you enter can represent the moment you want the closest facility routes to start or finish. Choose either Start time or End time accordingly.

Time of Day

The value you enter here represents the time of day that the closest facility routes will start or end.

The time you specify in Time of Day must be associated with a date. You can choose between entering a floating day (Day of Week) or a calendar date (Specific Date).

Specific Date

For a calendar date, you provide the day, month, and year that the Time of Day value is associated with.

Day of Week

For a floating day, you can choose Today or any day of the week (Sunday through Saturday) relative to the current date. Floating days enable you to configure an analysis layer that can be reused, without having to remember to change the date.

You can solve up to six days ahead relative to the current date when choosing Day of Week.

Using a start time with traffic data and time zones

If you use a time-based impedance attribute or accumulate attribute, the time and date you specify in Use Time refers to the time zone of the edge or junction on which the facility or incident is located.

A few requirements to be aware of when routing across multiple time zones are listed below.

  • All incidents must be in the same time zone when:
    • Specifying a start time and traveling from incident to facility
    • Specifying an end time and traveling from facility to incident
  • All facilities must be in the same time zone when:
    • Specifying a start time and traveling from facility to incident
    • Specifying an end time and traveling from incident to facility

Default Cutoff Value

While searching for the closest facility, Network Analyst can use a default cutoff value of impedance. Any facility beyond the cutoff value will not be searched. For instance, while locating the closest hospitals from the site of an accident, a cutoff value of 15 minutes would mean that Network Analyst would search for the closest hospital within 15 minutes from the incident. If the closest hospital is 17 minutes away, no hospitals will be returned in the closest facility search. A cutoff value is especially useful when searching for multiple facilities.

Individual facilities and incidents can have their own cutoff values that override this Default Cutoff Value. When traveling from incidents to facilities, a value in the cutoff property of an incident overrides the default. When traveling from facilities to incidents, a value in the cutoff property of a facility overrides the default.

Facilities To Find

Network Analyst can find multiple closest facilities from an incident. This is useful in situations, such as a fire, where multiple fire engines may be required from different fire stations. Network Analyst can find, for example, the nearest three fire stations to a fire. If you were to use a cutoff cost of 10 minutes, and the three closest stations were at 5, 7, and 11 minutes, only the first two stations would be returned by the closest facility search.

If any incidents have a value other than null for the TargetFacilityCount property, Facilities To Find will be overridden.

Travel From

You can specify whether you want to search for the closest facility as measured from the incident to the facility or from the facility to the incident. Restrictions, such as Oneway, and impedances, such as TravelTime, can be based on direction of travel, which can affect the results. For instance, a 10-minute drive may be required when traveling from the incident to the facility, but a 15-minute drive may be required when traveling in the opposite direction.

You may want to choose Incident to Facility to model a person finding the closest hospital. Similarly, Facility to Incident might model a fire truck responding from a fire station to an emergency since this is the critical part of the trip.

U-turns at Junctions

Network Analyst can allow U-turns everywhere, nowhere, only at dead ends (or culs-de-sac), or only at intersections and dead ends. Allowing U-turns implies the vehicle can turn around at a junction and double back on the same street.

Learn more about U-turn policies

Output Shape Type

The resulting routes of a closest facility analysis can be represented by the true shape with measures, true shape, straight lines, or none (no geometry).

NoteNote:

No matter which output shape type is chosen, the closest facilities are always determined by the network impedance, never Euclidean distance. This means only the route shapes are different, not the impedance-related values stored in the attribute tables.

  • True Shape gives the exact shape of the resulting route.

    Route as true shape

  • True Shape with Measures gives the exact shape of the resulting route. Furthermore, the output includes route measurements for linear referencing. The measurements increase from the first stop and record the cumulative impedance.

    Learn more about linear referencing

  • Straight Line results in a single, straight line between the stops.

    Straight line shape for route

  • When the output shape type is set to None, no shape is returned.

Use Hierarchy

If the network dataset has a hierarchy attribute, you can use the hierarchy during the analysis. Using a hierarchy results in the solver preferring higher-order edges to lower-order edges. Hierarchical solves are faster, and they can be used to simulate the driver preference of traveling on freeways instead of local roads—even if that means a longer trip. Not using a hierarchy, however, yields an exact route for the network dataset.

Learn more about routing with hierarchy

Ignore Invalid Locations

This property allows you to ignore invalid network locations and solve the analysis layer from valid network locations only. If this option is not checked and you have unlocated network locations, the solve may fail. In either case, the invalid locations are ignored in the analysis.

Directions

With the Directions properties, you can set the units for displaying distance and, optionally, time (if you have a time attribute). Additionally, you can choose to open directions automatically after the generation of a route. (If you choose not to display directions automatically, you can click the Directions Window button Directions on the Network Analyst toolbar to display directions.)

The Accumulation tab

Under the Accumulation tab, you can choose cost attributes from the network dataset to be accumulated on the route objects. These accumulation attributes are purely for reference; the solver only uses the cost attribute specified by the analysis layer's Impedance parameter to calculate the route.

For each cost attribute that is accumulated, a Total_[Impedance] property is added to the routes that are output by the solver, where [Impedance] is replaced with the name of the accumulated impedance attribute.

Assume you set the impedance attribute to Minutes because you want to find a route that minimizes travel time. Even though you're solving using travel time, you would also like to know the length of the quickest route. Suppose you have another cost attribute, Miles, that you check on in the Accumulation tab. After solving, the output route features will have properties named Total_Minutes and Total_Miles.

Conversely, you can find the shortest route and accumulate travel time to determine when the route will arrive at its stops and how long it will take to complete the trip. If you have a traffic-enabled network dataset, you can even find this information for a specific time of day and account for variable traffic speeds. To do this, choose a distance-based cost attribute for the impedance of the analysis layer, use a start time, and accumulate a time-dependent cost attribute.

The Network Locations tab

The parameters on the Network Locations tab are used to find network locations and set values for their properties.

Learn more about network locations

Related Topics

7/2/2014