ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Solve Location-Allocation

  • Summary
  • Illustration
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Chooses the best locations from a set of input locations.

Input to this tool includes facilities, which provide goods or services, and demand points, which consume the goods and services. The objective is to find the facilities that supply the demand points most efficiently. The tool solves this problem by analyzing various ways the demand points can be assigned to the different facilities. The solution is the scenario that allocates the most demand to facilities and minimizes overall travel. The output includes the solution facilities, demand points associated with their assigned facilities, and lines connecting demand points to their facilities.

The location-allocation tool can be configured to solve specific problem types. Examples include the following:

  • A retail store wants to see which potential store locations would need to be developed to capture 10 percent of the retail market in the area.

  • A fire department wants to determine where it should locate fire stations to reach 90 percent of the community within a four-minute response time.

  • A police department wants to preposition personnel given past criminal activity at night.

  • After a storm, a disaster response agency wants to find the best locations to set up triage facilities, with limited patient capacities, to tend to the affected population.

Learn about the output from Location-Allocation

Illustration

Locating shelters for emergency management

Usage

  • The tool dialog box groups the various optional parameters into the following seven categories to make it easier for you to manage them:

    • Advanced Analysis
    • Barriers
    • Custom Travel Mode
    • Location-Allocation Problem Settings
    • Network Dataset
    • Network Locations
    • Output
    • Service Capabilities

Syntax

arcpy.na.SolveLocationAllocation(Facilities, Demand_Points, Measurement_Units, Network_Dataset, Output_Geodatabase, Output_Allocation_Lines_Name, Output_Facilities_Name, Output_Demand_Points_Name, Output_Route_Edges_Name, {Problem_Type}, {Number_of_Facilities_to_Find}, {Default_Measurement_Cutoff}, {Default_Capacity}, {Target_Market_Share}, {Measurement_Transformation_Model}, {Measurement_Transformation_Factor}, {Travel_Direction}, {Time_of_Day}, {Time_Zone_for_Time_of_Day}, {UTurn_Policy}, {Point_Barriers}, {Line_Barriers}, {Polygon_Barriers}, {Time_Attribute}, {Time_Attribute_Units}, {Distance_Attribute}, {Distance_Attribute_Units}, {Use_Hierarchy_in_Analysis}, {Restrictions}, {Attribute_Parameter_Values}, {Accumulate_Attributes}, {Maximum_Snap_Tolerance}, {Feature_Locator_WHERE_Clause}, {Allocation_Line_Shape}, {Allocation_Line_Simplification_Tolerance}, {Maximum_Features_Affected_by_Point_Barriers}, {Maximum_Features_Affected_by_Line_Barriers}, {Maximum_Features_Affected_by_Polygon_Barriers}, {Maximum_Facilities}, {Maximum_Facilities_to_Find}, {Maximum_Demand_Points}, {Force_Hierarchy_Beyond_Distance}, {Save_Output_Network_Analysis_Layer}, {Travel_Mode}, {Overrides})
ParameterExplanationData Type
Facilities

Specify one or more facilities. The tool chooses the best locations from the set of facilities you specify here.

In a competitive analysis, in which you try to find the best locations in the face of competition, the facilities of the competitors are specified here as well.

When defining the facilities, you can set properties for each one, such as the facility name or type, by using attributes. Facilities can be specified with the following fields:

OBJECTID—The system-managed ID field.

SHAPE—The geometry field indicating the geographic location of the facility.

Name—The name of the facility. The name is included in the name of output allocation lines if the facility is part of the solution.

FacilityType—Specifies whether the facility is a candidate, required, or competitor facility. The field value is specified as one of the following integers (use the numeric code, not the name in parentheses):

  • 0 (Candidate)—A facility that may be part of the solution.
  • 1 (Required)—A facility that must be part of the solution.
  • 2 (Competitor)—A rival facility that potentially removes demand from your facilities. Competitor facilities are specific to the Maximize Market Share and Target Market Share problem types; they are ignored in other problem types.

Weight—The relative weighting of the facility, which is used to rate the attractiveness, desirability, or bias of one facility compared to another.

For example, a value of 2.0 could capture the preference of customers who prefer, at a ratio of 2 to 1, shopping in one facility over another facility. Factors that potentially affect facility weight include square footage, neighborhood, and age of the building. Weight values other than one are only honored by the maximize market share and target market share problem types; they are ignored in other problem types.

Capacity—The Capacity field is specific to the Maximize Capacitated Coverage problem type; the other problem types ignore this field.

Capacity specifies how much weighted demand the facility is capable of supplying. Excess demand won't be allocated to a facility even if that demand is within the facility's default measurement cutoff.

Any value assigned to the Capacity field overrides the Default Capacity parameter (Default_Capacity in Python) for the given facility.

CurbApproach—Specifies the direction a vehicle may arrive at or depart from the facility. The field value is specified as one of the following integers (use the numeric code, not the name in parentheses):

  • 0 (Either side of vehicle)—The facility can be visited from either the right or left side of the vehicle.
  • 1 (Right side of vehicle)—Arrive at or depart the facility so it is on the right side of the vehicle. This is typically used for vehicles such as buses that must arrive with the bus stop on the right-hand side so passengers can disembark at the curb.
  • 2 (Left side of vehicle)—Arrive at or depart the facility so it is on the left side of the vehicle. When the vehicle approaches and departs the facility, the curb must be on the left side of the vehicle. This is typically used for vehicles such as buses that must arrive with the bus stop on the left-hand side so passengers can disembark at the curb.

The CurbApproach property is designed to work with both kinds of national driving standards: right-hand traffic (United States) and left-hand traffic (United Kingdom). First, consider a facility on the left side of a vehicle. It is always on the left side regardless of whether the vehicle travels on the left or right half of the road. What may change with national driving standards is your decision to approach a facility from one of two directions, that is, so it ends up on the right or left side of the vehicle. For example, if you want to arrive at a facility and not have a lane of traffic between the vehicle and the incident, you would choose Right side of vehicle (1) in the United States but Left side of vehicle (2) in the United Kingdom.

Feature Set
Demand_Points

Specify one or more demand points. The tool chooses the best facilities based in large part on how they serve the demand points specified here.

When defining the demand points, you can set properties for each one, such as the demand-point name or weight, by using attributes. Demand points can be specified with the following fields:

OBJECTID—The system-managed ID field.

SHAPE—The geometry field indicating the geographic location of the facility.

Name—The name of the demand point. The name is included in the name of an output allocation line or lines if the demand point is part of the solution.

GroupName—The name of the group the demand point is part of. This property is ignored for the maximize capacitated coverage, target market share, and maximize market share problem types.

If demand points share a group name, the solver allocates all members of the group to the same facility. (If constraints, such as a cutoff distance, prevent any of the demand points in the group from reaching the same facility, none of the demand points are allocated.)

Weight—The relative weighting of the demand point. A value of 2.0 means the demand point is twice as important as one with a weight of 1.0. If demand points represent households, weight could indicate the number of people in each household.

Cutoff_Time—The demand point can't be allocated to a facility that is beyond the travel time indicated here. This field value overrides the value of the Default Measurement Cutoff parameter.

The units for this attribute value are specified by the Measurement Units parameter. The attribute value is referenced during the analysis only when the measurement units are time based. The default value is null, which means there isn't an override cutoff.

Cutoff_Distance—The demand point can't be allocated to a facility that is beyond the travel distance indicated here. This field value overrides the value of the Default Measurement Cutoff parameter.

The units for this attribute value are specified by the Measurement Units parameter. The attribute value is referenced during the analysis only when the measurement units are distance based. The default value is null, which means there isn't an override cutoff.

CurbApproach—Specifies the direction a vehicle may arrive at or depart from the facility. The field value is specified as one of the following integers (use the numeric code, not the name in parentheses):

  • 0 (Either side of vehicle)—The demand point can be visited from either the right or left side of the vehicle.
  • 1 (Right side of vehicle)—Arrive at or depart the demand point so it is on the right side of the vehicle. This is typically used for vehicles such as buses that must arrive with the bus stop on the right-hand side so passengers can disembark at the curb.
  • 2 (Left side of vehicle)—Arrive at or depart the demand point so it is on the left side of the vehicle. When the vehicle approaches and departs the demand point, the curb must be on the left side of the vehicle. This is typically used for vehicles such as buses that must arrive with the bus stop on the left-hand side so passengers can disembark at the curb.

The CurbApproach property is designed to work with both kinds of national driving standards: right-hand traffic (United States) and left-hand traffic (United Kingdom). First, consider a demand point on the left side of a vehicle. It is always on the left side regardless of whether the vehicle travels on the left or right half of the road. What may change with national driving standards is your decision to approach a demand point from one of two directions, that is, so it ends up on the right or left side of the vehicle. For example, if you want to arrive at a demand point and not have a lane of traffic between the vehicle and the demand point, you would choose Right side of vehicle (1) in the United States but Left side of vehicle (2) in the United Kingdom.

Feature Set
Measurement_Units

Specify the units that should be used to measure the travel times or travel distances between demand points and facilities. The tool chooses the best facilities based on which ones can reach, or be reached by, the most amount of weighted demand with the least amount travel.

The output allocation lines report travel distance or travel time in different units, including the units you specify for this parameter. The choices are

  • Meters
  • Kilometers
  • Feet
  • Yards
  • Miles
  • NauticalMiles
  • Seconds
  • Minutes
  • Hours
  • Days

The tool chooses whether to use the network cost attribute specified in the Time Attribute or Distance Attribute parameter depending on whether the chosen measurement units are time or distance based.

The tool performs the necessary unit conversion when the Measurement Units value differs from the units of the corresponding time or distance cost attribute.

String
Network_Dataset

The network dataset on which the analysis will be performed. Network datasets most often represent street networks but may represent other kinds of transportation networks as well. The network dataset needs at least one time-based and one distance-based cost attribute.

Network Dataset Layer
Output_Geodatabase

The output workspace. This workspace must already exist. The default output workspace is in_memory.

Workspace
Output_Allocation_Lines_Name

The name of the output feature class containing the lines that connect demand points to their assigned facilities.

Output from Solve Location-Allocation describes the schema of this output feature class.

String
Output_Facilities_Name

The name of the output feature class containing the facilities.

Output from Solve Location-Allocation describes the schema of this output feature class.

String
Output_Demand_Points_Name

The name of the output feature class containing the demand points.

Output from Solve Location-Allocation describes the schema of this output feature class.

String
Output_Route_Edges_Name

The name of the output feature class containing the route edges. Route edges represent the individual street features that are traversed along the shortest path between the demand points and the facilities to which they are allocated.

This output is often used to determine which street segments would experience the most traffic when traveling to facilities. This information can be used, for example, to place advertisements or expand roads to support traffic loads during evacuations.

To populate the output RouteEdges feature class, you need to set the Allocation Line Shape parameter to true lines.

Output from Solve Location-Allocation describes the schema of this output feature class.

String
Problem_Type
(Optional)

Specifies the objective of the location-allocation analysis. The default objective is to minimize impedance.

  • MINIMIZE_IMPEDANCE —This is also known as the P-Median problem type. Facilities are located such that the sum of all weighted travel time or distance between demand points and solution facilities is minimized. (Weighted travel is the amount of demand allocated to a facility multiplied by the travel distance or time to the facility.)This problem type is traditionally used to locate warehouses, because it can reduce the overall transportation costs of delivering goods to outlets. Since Minimize Impedance reduces the overall distance the public needs to travel to reach the chosen facilities, the minimize impedance problem without an impedance cutoff is ordinarily regarded as more equitable than other problem types for locating some public-sector facilities such as libraries, regional airports, museums, department of motor vehicles offices, and health clinics.The following list describes how the minimize impedance problem type handles demand:
    • A demand point that cannot reach any facilities due to setting a cutoff distance or time is not allocated.
    • A demand point that can only reach one facility has all its demand weight allocated to that facility.
    • A demand point that can reach two or more facilities has all its demand weight allocated to the nearest facility only.
  • MAXIMIZE_CAPACITATED_COVERAGE —Facilities are located such that all or the greatest amount of demand can be served without exceeding the capacity of any facility.Maximize Capacitated Coverage behaves like either the Minimize Impedance or Maximize Coverage problem type but with the added constraint of capacity. You can specify a capacity for an individual facility by assigning a numeric value to its corresponding Capacity field on the input facilities. If the Capacity field value is null, the facility is assigned a capacity from the Default Capacity property.Use-cases for Maximize Capacitated Coverage include creating territories that encompass a given number of people or businesses, locating hospitals or other medical facilities with a limited number of beds or patients who can be treated, or locating warehouses whose inventory isn't assumed to be unlimited. The following list describes how the Maximize Capacitated Coverage problem handles demand:
    • Unlike Maximize Coverage, Maximize Capacitated Coverage doesn't require a value for the Default Measurement Cutoff; however, when a cutoff is specified, any demand point outside the cutoff time or distance of all facilities is not allocated.
    • An allocated demand point has all or none of its demand weight assigned to a facility; that is, demand isn't apportioned with this problem type.
    • If the total demand that can reach a facility is greater than the capacity of the facility, only the demand points that maximize total captured demand and minimize total weighted travel are allocated.
      Note:

      You may notice an apparent inefficiency when a demand point is allocated to a facility that isn't the nearest solution facility. This may occur when demand points have varying weights and when the demand point in question can reach more than one facility. This kind of result indicates the nearest solution facility didn't have adequate capacity for the weighted demand, or the most efficient solution for the entire problem required one or more local inefficiencies. In either case, the solution is correct.

  • MAXIMIZE_COVERAGE —Facilities are located such that as much demand as possible is allocated to solution facilities within the impedance cutoff.Maximize Coverage is frequently used to locate fire stations, police stations, and ERS centers, because emergency services are often required to arrive at all demand points within a specified response time. Note that it is important for all organizations, and critical for emergency services, to have accurate and precise data so analysis results correctly model real-world results.Pizza delivery businesses, as opposed to eat-in pizzerias, try to locate stores where they can cover the most people within a certain drive time. People who order pizzas for delivery don't typically worry about how far away the pizzeria is; they are mainly concerned with the pizza arriving within an advertised time window. Therefore, a pizza-delivery business would subtract pizza-preparation time from their advertised delivery time and solve a maximize coverage problem to choose the candidate facility that would capture the most potential customers in the coverage area. (Potential customers of eat-in pizzerias are more affected by distance, since they need to travel to the restaurant; thus, the attendance maximizing or market share problem types would better suit eat-in restaurants.)The following list describes how the Maximize Coverage problem handles demand:
    • A demand point that cannot reach any facilities due to cutoff distance or time is not allocated.
    • A demand point that can only reach one facility has all its demand weight allocated to that facility.
    • A demand point that can reach two or more facilities has all its demand weight allocated to the nearest facility only.
  • MAXIMIZE_MARKET_SHARE —A specific number of facilities are chosen such that the allocated demand is maximized in the presence of competitors. The goal is to capture as much of the total market share as possible with a given number of facilities, which you specify. The total market share is the sum of all demand weight for valid demand points.The market share problem types require the most data because, along with knowing your own facilities' weight, you also need to know that of your competitors' facilities. The same types of facilities that use the Maximize Attendance problem type can also use market share problem types given that they have comprehensive information that includes competitor data. Large discount stores typically use Maximize Market Share to locate a finite set of new stores. The market share problem types use a Huff model, which is also known as a gravity model or spatial interaction.The following list describes how the Maximize Market Share problem handles demand:
    • A demand point that cannot reach any facilities due to a cutoff distance or time is not allocated.
    • A demand point that can only reach one facility has all its demand weight allocated to that facility.
    • A demand point that can reach two or more facilities has all its demand weight allocated to them; furthermore, the weight is split among the facilities proportionally to the facilities' attractiveness (facility weight) and inversely proportional to the distance between the facility and demand point. Given equal facility weights, this means more demand weight is assigned to near facilities than far facilities.

    • The total market share, which can be used to calculate the captured market share, is the sum of the weight of all valid demand points.

  • MINIMIZE_FACILITIES —Facilities are chosen such that as much weighted demand as possible is allocated to solution facilities within the travel time or distance cutoff; additionally, the number of facilities required to cover demand is minimized.Minimize Facilities is the same as Maximize Coverage but with the exception of the number of facilities to locate, which in this case is determined by the solver. When the cost of building facilities is not a limiting factor, the same kinds of organizations that use Maximize Coverage (emergency response, for instance) use Minimize Facilities so all possible demand points will be covered. The following list describes how the Minimize Facilities problem handles demand:
    • A demand point that cannot reach any facilities due to a cutoff distance or time is not allocated.
    • A demand point that can only reach one facility has all its demand weight allocated to that facility.
    • A demand point that can reach two or more facilities has all its demand weight allocated to the nearest facility only.
  • MAXIMIZE_ATTENDANCE —Facilities are chosen such that as much demand weight as possible is allocated to facilities while assuming the demand weight decreases in relation to the distance between the facility and the demand point.Specialty stores that have little or no competition benefit from this problem type, but it may also be beneficial to general retailers and restaurants that don't have the data on competitors necessary to perform market share problem types. Some businesses that might benefit from this problem type include coffee shops, fitness centers, dental and medical offices, and electronics stores. Public transit bus stops are often chosen with the help of Maximize Attendance. Maximize Attendance assumes that the farther people have to travel to reach your facility, the less likely they are to use it. This is reflected in how the amount of demand allocated to facilities diminishes with distance.The following list describes how the Maximize Attendance problem handles demand:
    • A demand point that cannot reach any facilities due to a cutoff distance or time is not allocated.
    • When a demand point can reach a facility, its demand weight is only partially allocated to the facility. The amount allocated decreases as a function of the maximum cutoff distance (or time) and the travel distance (or time) between the facility and the demand point.
    • The weight of a demand point that can reach more than one facility is proportionately allocated to the nearest facility only.
  • TARGET_MARKET_SHARE —Target Market Share chooses the minimum number of facilities necessary to capture a specific percentage of the total market share in the presence of competitors. The total market share is the sum of all demand weight for valid demand points. You set the percent of the market share you want to reach and let the solver choose the fewest number of facilities necessary to meet that threshold.The market share problem types require the most data because, along with knowing your own facilities' weight, you also need to know that of your competitors' facilities. The same types of facilities that use the Maximize Attendance problem type can also use market share problem types given that they have comprehensive information that includes competitor data.Large discount stores typically use the Target Market Share problem type when they want to know how much expansion would be required to reach a certain level of the market share or see what strategy would be needed just to maintain their current market share given the introduction of new competing facilities. The results often represent what stores would like to do if budgets weren't a concern. In other cases where budget is a concern, stores revert to the Maximize Market Share problem and simply capture as much of the market share as possible with a limited number of facilities.The following list describes how the target market share problem handles demand:
    • The total market share, which is used in calculating the captured market share, is the sum of the weight of all valid demand points.
    • A demand point that cannot reach any facilities due to a cutoff distance or time is not allocated.
    • A demand point that can only reach one facility has all its demand weight allocated to that facility.
    • A demand point that can reach two or more facilities has all its demand weight allocated to them; furthermore, the weight is split among the facilities proportionally to the facilities' attractiveness (facility weight) and inversely proportional to the distance between the facility and demand point. Given equal facility weights, this means more demand weight is assigned to near facilities than far facilities.
String
Number_of_Facilities_to_Find
(Optional)

Specify the number of facilities the solver should choose. The default value is 1.

The facilities with a FacilityType field value of 1 (Required) are always chosen first. Any excess facilities to choose are picked from candidate facilities, which have a FacilityType field value of 2.

Any facilities that have a FacilityType value of 3 (Chosen) before solving are treated as candidate facilities at solve time.

If the number of facilities to find is less than the number of required facilities, an error occurs.

Number of Facilities to Find is disabled for the Minimize Facilities and Target Market Share problem types since the solver determines the minimum number of facilities needed to meet the objectives.

Long
Default_Measurement_Cutoff
(Optional)

Specifies the maximum travel time or distance allowed between a demand point and the facility it is allocated to. If a demand point is outside the cutoff of a facility, it cannot be allocated to that facility.

The default value is none, which means the cutoff limit doesn't apply.

The units for this parameter are the same as those specified by the Measurement Units parameter.

The travel time or distance cutoff is measured by the shortest path along roads.

This property might be used to model the maximum distance that people are willing to travel to visit stores or the maximum time that is permitted for a fire department to reach anyone in the community.

Note that demand points have Cutoff_Time and Cutoff_Distance fields, which, if set accordingly, overrides the Default Measurement Cutoff parameter. You might find that people in rural areas are willing to travel up to 10 miles to reach a facility while urbanites are only willing to travel up to two miles. Assuming Measurement Units is set to Miles, you can model this behavior by setting the default measurement cutoff to 10 and the Cutoff_Distance field value of the demand points in urban areas to 2.

Double
Default_Capacity
(Optional)

This property is specific to the Maximize Capacitated Coverage problem type. It is the default capacity assigned to all facilities in the analysis. You can override the default capacity for a facility by specifying a value in the facility's Capacity field.

The default value is 1.

Double
Target_Market_Share
(Optional)

This parameter is specific to the Target Market Share problem type. It is the percentage of the total demand weight that you want the chosen and required facilities to capture. The solver chooses the minimum number of facilities needed to capture the target market share specified here.

The default value is 10 percent.

Double
Measurement_Transformation_Model
(Optional)

This sets the equation for transforming the network cost between facilities and demand points. This property, coupled with the Impedance Parameter, specifies how severely the network impedance between facilities and demand points influences the solver's choice of facilities.

In the following list of transformation options, d refers to demand points and f, facilities. Impedance refers to the shortest travel distance or time between two locations. So impedancedf is the shortest-path (time or distance) between demand point d and facility f, and costdf is the transformed travel time or distance between the facility and demand point. Lambda (λ) denotes the impedance parameter. The Measurement Units setting determines whether travel time or distance is analyzed.

  • LINEAR —costdf = λ * impedancedfThe transformed travel time or distance between the facility and the demand point is the same as the time or distance of the shortest path between the two locations. With this option, the impedance parameter (λ) is always set to one. This is the default.
  • POWER —costdf = impedancedfλThe transformed travel time or distance between the facility and the demand point is equal to the time or distance of the shortest path raised to the power specified by the impedance parameter (λ). Use the Power option with a positive impedance parameter to specify higher weight to nearby facilities.
  • EXPONENTIAL —costdf = e(λ * impedancedf)The transformed travel time or distance between the facility and the demand point is equal to the mathematical constant e raised to the power specified by the shortest-path network impedance multiplied with the impedance parameter (λ). Use the Exponential option with a positive impedance parameter to specify a high weight to nearby facilities.
String
Measurement_Transformation_Factor
(Optional)

Provides a parameter value to the equations specified in the Measurement Transformation Model parameter. The parameter value is ignored when the impedance transformation is of type linear. For power and exponential impedance transformations, the value should be nonzero.

The default value is 1.

Double
Travel_Direction
(Optional)

Specify whether to measure travel times or distances from facilities to demand points or from demand points to facilities. The default value is to measure from facilities to demand points.

  • FACILITY_TO_DEMAND —Direction of travel is from facilities to demand points. This is the default.
  • DEMAND_TO_FACILITY —Direction of travel is from demand points to facilities.

Travel times and distances may change based on direction of travel. If going from point A to point B, you may encounter less traffic or have a shorter path, due to one-way streets and turn restrictions, than if you were traveling in the opposite direction. For instance, going from point A to point B may only take 10 minutes, but going the other direction may take 15 minutes. These differing measurements may affect whether demand points can be assigned to certain facilities because of cutoffs or, in problem types where demand is apportioned, affect how much demand is captured.

Fire departments commonly measure from facilities to demand points since they are concerned with the time it takes to travel from the fire station to the location of the emergency. A retail store is more concerned with the time it takes shoppers to reach the store; therefore, stores commonly measure from demand points to facilities.

Travel Direction also determines the meaning of any start time that is provided. See the Time of Day parameter for more information.

String
Time_of_Day
(Optional)

Specify the time at which travel begins. This property is ignored unless Measurement Units are time based. The default is no time or date. When Time of Day isn't specified, the solver uses generic speeds—typically those from posted speed limits.

Traffic constantly changes in reality, and as it changes, travel times between facilities and demand points also fluctuate. Therefore, indicating different time and date values over several analyses may affect how demand is allocated to facilities and which facilities are chosen in the results.

The time of day always indicates a start time. However, travel may start from facilities or demand points; it depends on what you choose for the Travel Direction parameter.

The Time Zone for Time of Day parameter specifies whether this time and date refer to UTC or the time zone in which the facility or demand point is located.

Date
Time_Zone_for_Time_of_Day
(Optional)

Specifies the time zone of the Time of Day parameter. The default is geographically local.

  • GEO_LOCAL —The Time of Day parameter refers to the time zone in which the facilities or demand points are located. If Travel Direction is facilities to demand points, this is the time zone of the facilities. If Travel Direction is demand points to facilities, this is the time zone of the demand points.
  • UTC —The Time of Day parameter refers to Coordinated Universal Time (UTC). Choose this option if you want to choose the best location for a specific time, such as now, but aren't certain in which time zone the facilities or demand points will be located.

Irrespective of the Time Zone for Time of Day setting, the following rules are enforced by the tool if your facilities and demand points are in multiple time zones:

  • All facilities must be in the same time zone when specifying a time of day and travel is from facility to demand.
  • All demand points must be in the same time zone when specifying a time of day and travel is from demand to facility.

String
UTurn_Policy
(Optional)

The U-Turn policy at junctions. Allowing U-turns implies the solver can turn around at a junction and double back on the same street. Given that junctions represent street intersections and dead ends, different vehicles may be able to turn around at some junctions but not at others—it depends on whether the junction represents an intersection or dead end. To accommodate, the U-turn policy parameter is implicitly specified by how many edges, or streets, connect to the junction, which is known as junction valency. The acceptable values for this parameter are listed below; each is followed by a description of its meaning in terms of junction valency.

  • ALLOW_UTURNS —U-turns are permitted at junctions with any number of connected edges, or streets. This is the default value.
  • NO_UTURNS —U-turns are prohibited at all junctions, regardless of junction valency.
  • ALLOW_DEAD_ENDS_ONLY —U-turns are prohibited at all junctions, except those that have only one adjacent edge (a dead end).
  • ALLOW_DEAD_ENDS_AND_INTERSECTIONS_ONLY —U-turns are prohibited at junctions where exactly two adjacent edges meet but are permitted at intersections (junctions with three or more adjacent edges) and dead ends (junctions with exactly one adjacent edge). Often, networks modeling streets have extraneous junctions in the middle of road segments. This option prevents vehicles from making U-turns at these locations.

The value of this parameter is overridden when Travel Mode (Travel_Mode in Python) is set to any value other than custom.

String
Point_Barriers
(Optional)

Specifies point barriers, which are split into two types: restriction and added cost point barriers. They temporarily restrict traversal across or add impedance to points on the network. The point barriers are defined by a feature set, and the attribute values you specify for the point features determine whether they are restriction or added cost barriers. The fields in the attribute table are listed and described below.

ObjectID:

The system-managed ID field.

Shape:

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

Name:

The name of the barrier.

BarrierType:

Specifies whether the barrier restricts travel completely or adds cost when traveling through it. There are two options:

  • Restriction (0)—Prohibits traversing through the barrier. This is the default value.
  • Added Cost (2)—Traversing through the barrier increases the network cost by the amount specified in the Additional_Time and Additional_Distance fields.

Use the value 0 for Restriction and 2 for Added Cost.

Additional_Time:

Indicates how much travel time is added when the barrier is traversed. This field is applicable only for added-cost barriers and only if the measurement units are time based. This field value must be greater than or equal to zero, and its units are the same as those specified in the Measurement Units parameter.

Additional_Distance:

Indicates how much distance is added when the barrier is traversed. This field is applicable only for added-cost barriers and only if the measurement units are distance based. The field value must be greater than or equal to zero, and its units are the same as those specified in the Measurement Units parameter.

Feature Set
Line_Barriers
(Optional)

Specifies line barriers, which temporarily restrict traversal across them. The line barriers are defined by a feature set. The fields in the attribute table are listed and described below.

ObjectID:

The system-managed ID field.

Shape:

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

Name:

The name of the barrier.

Feature Set
Polygon_Barriers
(Optional)

Specifies polygon barriers, which are split into two types: restriction and scaled cost polygon barriers. They temporarily restrict traversal or scale impedance on the parts of the network they cover. The polygon barriers are defined by a feature set, and the attribute values you specify for the polygon features determine whether they are restriction or scaled cost barriers. The fields in the attribute table are listed and described below.

ObjectID:

The system-managed ID field.

Shape:

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

Name:

The name of the barrier.

BarrierType:

Specifies whether the barrier restricts travel completely or scales the cost of traveling through it. There are two options:

  • Restriction (0)—Prohibits traversing through any part of the barrier. This is the default value.
  • Scaled Cost (1)—Scales the impedance of underlying edges by multiplying them by the value of the ScaledCostFactor property. If edges are partially covered by the barrier, the impedance is apportioned and multiplied.

Use the value 0 for Restriction and 1 for Scaled Cost.

ScaledTimeFactor:

This is the factor by which the travel time of the streets intersected by the barrier is multiplied. This field is applicable only for scaled-cost barriers and only if the measurement units are time based. The field value must be greater than zero.

ScaledDistanceFactor:

This is the factor by which the distance of the streets intersected by the barrier is multiplied. This attribute is applicable only for scaled-cost barriers and only if the measurement units are distance based. The attribute value must be greater than zero.

Feature Set
Time_Attribute
(Optional)

Defines the network cost attribute to use when the measurement units value is a time unit.

The tool performs the necessary time-unit conversion when the measurement units value differs from the units of the cost attribute defined here. In other words, the time units of the default cutoff and the network cost attribute don't need to be the same.

The value of this parameter is overridden when Travel Mode (Travel_Mode in Python) is set to any value other than Custom.

String
Time_Attribute_Units
(Optional)

The units of the time attribute. You can explicitly set the time attribute units, but it is recommended to pass nothing or "#" and let the solver determine the units.

The value of this parameter is overridden when Travel_Mode is set to any value other than CUSTOM.

String
Distance_Attribute
(Optional)

Defines the network cost attribute to use when the measurement units value is a distance unit.

The tool performs the necessary distance-unit conversion when the measurement units value differs from the units of the cost attribute defined here. In other words, the measurement units and the distance units of the network cost attribute don't need to be the same.

The value of this parameter is overridden when Travel Mode (Travel_Mode in Python) is set to any value other than Custom.

String
Distance_Attribute_Units
(Optional)

The units of the distance attribute. You can explicitly set the distance attribute units, but it is recommended to pass nothing or "#" and let the solver determine the units.

The value of this parameter is overridden when Travel_Mode is set to any value other than CUSTOM.

String
Use_Hierarchy_in_Analysis
(Optional)

Specify whether hierarchy should be used when finding the shortest routes between points.

  • USE_HIERARCHY — Use hierarchy when finding routes. When hierarchy is used, the tool prefers higher-order streets (such as freeways) to lower-order streets (such as local roads) and can be used to simulate the driver preference of traveling on freeways instead of local roads even if that means a longer trip. This is especially true when finding routes to faraway facilities, because drivers on long-distance trips tend to prefer traveling on freeways where stops, intersections, and turns can be avoided. Using hierarchy is computationally faster, especially for long-distance routes, because the tool has to select the best route from a relatively smaller subset of streets.
  • NO_HIERARCHY — Do not use hierarchy when finding routes. If hierarchy is not used, the tool considers all the streets and doesn't prefer higher-order streets when finding the route. This is often used when finding short-distance routes within a city.

The parameter is not used if a hierarchy attribute is not defined on the network dataset used to perform the analysis. In such cases, use "#" as the parameter value.

You can use the Force_Hierarchy_Beyond_Distance parameter to force the solve to use hierarchy even if Use_Hierarchy_in_Analysis is set to False.

This parameter is ignored unless Travel_Mode is set to CUSTOM. When modeling a custom walking mode, it is recommended to turn off hierarchy since the hierarchy is designed for motorized vehicles.

Boolean
Restrictions
[restriction,...]
(Optional)

Indicates which network restriction attributes are respected during solve time.

The value of this parameter is overridden when Travel Mode (Travel_Mode in Python) is set to any value other than custom.

String
Attribute_Parameter_Values
(Optional)

Specifies the parameter values for network attributes that have parameters. The record set has two columns that work together to uniquely identify parameters and another column that specifies the parameter value.

The value of this parameter is overridden when Travel Mode (Travel_Mode in Python) is set to any value other than custom.

The attribute parameter values record set has associated attributes. The fields in the attribute table are listed below and described.

ObjectID:

The system-managed ID field.

AttributeName:

The name of the network attribute whose attribute parameter is set by the table row.

ParameterName:

The name of the attribute parameter whose value is set by the table row. (Object type parameters cannot be updated using this tool.)

ParameterValue:

The value you want for the attribute parameter. If a value is not specified, the attribute parameter is set to null.

Record Set
Accumulate_Attributes
[attribute,...]
(Optional)

List of cost attributes to be accumulated during analysis. These accumulation attributes are purely for reference; the solver only uses the cost attribute specified by the Time Attribute (Time_Attribute in Python) or Distance Attribute (Distance_Attribute in Python) parameter to calculate the shortest paths.

For each cost attribute that is accumulated, a Total_[attribute] field is added to the routes that are output by the solver.

String
Maximum_Snap_Tolerance
(Optional)

The maximum snap tolerance is the furthest distance that Network Analyst searches when locating or relocating a point onto the network. The search looks for suitable edges or junctions and snaps the point to the nearest one. If a suitable location isn't found within the maximum snap tolerance, the object is marked as unlocated.

Linear Unit
Feature_Locator_WHERE_Clause
(Optional)

An SQL expression used to select a subset of source features that limits on which network elements facilities and demand points can be located. The syntax for this parameter consists of two parts: the first is the source feature class name (followed by a space) and the second is the SQL expression. To write an SQL expression for two or more source feature classes, separate them with a semicolon.

To ensure facilities are not located on limited-access highways, for example, write an SQL expression like the following to exclude those source features: "Streets" "FUNC_CLASS not in('1', '2')".

Note that barriers ignore the feature locator WHERE clause when loading.

String
Allocation_Line_Shape
(Optional)

Specify the type of line features that are output by the tool. The parameter accepts one of the following values:

  • STRAIGHT_LINES —Return straight lines between solution facilities and the demand points allocated to them. This is the default. Drawing straight lines on a map helps you visualize how demand is allocated.
  • TRUE_LINES_WITHOUT_MEASURES —Return the exact shape of the shortest paths connecting solution facilities to their allocated demand points.
  • TRUE_LINES_WITH_MEASURES — Return the exact shape of the shortest paths connecting solution facilities to their allocated demand points. Additionally, constructs measures so the shape may be used in linear referencing. The measure values are in the units specified by the Measurements Units (Measurement_Units in Python) parameter.
  • NO_LINES —Return a table containing data about the shortest paths between solution facilities and the demand points allocated to them, but don't return lines.

No matter which value you choose for the Allocation Line Shapeparameter, the shortest route is always determined by minimizing the travel time or the travel distance, never using the straight-line distance between demand points and facilities. That is, this parameter only changes the output line shapes; it doesn't change the measurement method.

When the Allocation Line Shape (Allocation_Line_Shape in Python) parameter is set to True lines without measures or True lines with measures, the generalization of the route shape can be further controlled using the appropriate value for the Allocation Line Simplification Tolerance(Allocation_Line_Simplification_Tolerance in Python) parameter.

String
Allocation_Line_Simplification_Tolerance
(Optional)

Specify by how much you want to simplify the allocation line geometry.

The tool ignores this parameter if the Allocation Line Shape parameter (Allocation_Line_Shape in Python) isn't set to output true lines.

Simplification maintains critical points on a route, such as turns at intersections, to define the essential shape of the route and removes other points. The simplification distance you specify is the maximum allowable offset that the simplified line can deviate from the original line. Simplifying a line reduces the number of vertices that are part of the route geometry. This improves the tool execution time and reduces the time it takes to draw lines.

The value of this parameter is overridden when Travel Mode (Travel_Mode in Python) is set to any value other than custom.

Linear Unit
Maximum_Features_Affected_by_Point_Barriers
(Optional)

Limits how many features can be affected by point barriers.

This parameter helps you govern the amount of processing that occurs when solving. For example, you could assign a low value to this parameter for a free version of the service you are creating and use a higher value for a paid-subscription version of the service.

A null value indicates there is no limit.

Long
Maximum_Features_Affected_by_Line_Barriers
(Optional)

Limits how many features can be affected by line barriers.

This parameter helps you govern the amount of processing that occurs when solving. For example, you could assign a low value to this parameter for a free version of the service you are creating and use a higher value for a paid-subscription version of the service.

A null value indicates there is no limit.

Long
Maximum_Features_Affected_by_Polygon_Barriers
(Optional)

Limits how many features can be affected by polygon barriers.

This parameter helps you govern the amount of processing that occurs when solving. For example, you could assign a low value to this parameter for a free version of the service you are creating and use a higher value for a paid-subscription version of the service.

A null value indicates there is no limit.

Long
Maximum_Facilities
(Optional)

Limits how many facilities can be added to the location-allocation analysis. This parameter is related to the Facilities parameter.

This parameter helps you govern the amount of processing that occurs when solving. For example, you could assign a low value to this parameter for a free version of the service you are creating and use a higher value for a paid-subscription version of the service.

A null value indicates there is no limit.

Long
Maximum_Facilities_to_Find
(Optional)

Limits how many facilities can be added to the location-allocation analysis. This parameter is related to the Number of Facilities to Find (Number_of_Facilities_to_Find in Python) parameter.

This parameter helps you govern the amount of processing that occurs when solving. For example, you could assign a low value to this parameter for a free version of the service you are creating and use a higher value for a paid-subscription version of the service.

A null value indicates there is no limit.

Long
Maximum_Demand_Points
(Optional)

Limits how many demand points can be added to the location-allocation analysis. This parameter is related to the Demand Points (Demand_Points in Python) parameter.

This parameter helps you govern the amount of processing that occurs when solving. For example, you could assign a low value to this parameter for a free version of the service you are creating and use a higher value for a paid-subscription version of the service.

A null value indicates there is no limit.

Long
Force_Hierarchy_Beyond_Distance
(Optional)

Specifies the distance after which the solver will force hierarchy, even if hierarchy is not enabled, when finding shortest paths between facilities and demand points. The units of this parameter are the same as those shown in the Distance Attribute Units (Distance_Attribute_Units in Python) parameter.

Finding shortest routes between facilities and demand points that are far away while using the network's hierarchy tends to incur much less processing than finding the same routes without using the hierarchy. This parameter helps you govern the amount of processing that occurs when solving.

A null value indicates that the hierarchy will never be enforced and the value of the Use Hierarchy in Analysis (Use_Hierarchy_in_Analysis in Python) parameter will always be honored. If the input network dataset does not support hierarchy, specifying a value for this parameter will result in an error. A null value should be used in this case.

This parameter is disabled unless the network dataset includes a hierarchy attribute.

Double
Save_Output_Network_Analysis_Layer
(Optional)
  • NO_SAVE_OUTPUT_LAYER —A network analysis layer isn't included in the output.
  • SAVE_OUTPUT_LAYER —The output includes a network analysis layer of the results.

In either case, feature classes containing the results are returned. However, a server administrator may want to choose to output a network analysis layer as well so the setup and results of the tool can be debugged using the Network Analyst controls in the ArcGIS Desktop environment. This can make the debugging process much easier.

In ArcGIS Desktop, the default output location for the network analysis layer is in the scratch folder. You can determine the location of the scratch folder by evaluating the value of arcpy.env.scratchFolder geoprocessing environment. The output network analysis layer is stored as an LYR file whose name begins with _ags_gpna and is followed by an alphanumeric GUID.

Boolean
Travel_Mode
(Optional)

Choose the mode of transportation for the analysis. CUSTOM is always a choice. For other travel mode names to appear, they must be present in the network dataset specified in the Network_Dataset parameter. (The arcpy.na.GetTravelModes function provides a dictionary of the travel mode objects configured on a network dataset, and the name property returns the name of a travel mode object.)

A travel mode is defined on a network dataset and provides override values for parameters that, together, model car, truck, pedestrian, or other modes of travel. By choosing a travel mode here, you don't need to provide values for the following parameters, which are overridden by values specified in the network dataset:

  • UTurn_Policy

  • Time_Attribute

  • Time_Attribute_Units

  • Distance_Attribute

  • Distance_Attribute_Units

  • Use_Hierarchy_in_Analysis

  • Restrictions

  • Attribute_Parameter_Values

  • Route_Line_Simplification_Tolerance

  • CUSTOM —Define a travel mode that fits your specific needs. When CUSTOM is chosen, the tool does not override the travel mode parameters listed above. This is the default value.
String
Overrides
(Optional)

Specify additional settings that can influence the behavior of the solver when finding solutions for the network analysis problems.

The value for this parameter needs to be specified in JavaScript Object Notation (JSON). For example, a valid value is of the following form {"overrideSetting1" : "value1", "overrideSetting2" : "value2"}. The override setting name is always enclosed in double quotation marks. The values can be either a number, Boolean, or a string.

The default value for this parameter is no value, which indicates not to override any solver settings.

Overrides are advanced settings that should be used only after careful analysis of the results obtained before and after applying the settings. A list of supported override settings for each solver and their acceptable values can be obtained by contacting Esri Technical Support.

String

Derived Output

NameExplanationData Type
Solve_Succeeded

Determines if the service was able to successfully choose the best facilities.

Boolean
Output_Allocation_Lines

Lines that connect demand points to the facilities to which they were allocated.

Feature Class
Output_Facilities

Accesses the chosen, required, and competitor facilities, as well as any candidate facilities that were not chosen.

Feature Class
Output_Demand_Points

The demand points that participated in the analysis.

Feature Class
Output_Route_Edges

Represents the individual road segments along the shortest route between demand points and the facilities they are allocated to.

Feature Class
Output_LocationAllocation_Analysis_Layer

The output location allocation analysis layer.

File
Output_Route_Analysis_Layer

The output route analysis layer.

File

Code sample

SolveLocationAllocation example 1 (Python window)

Execute the SolveLocationAllocation tool using the required parameters.

facilities = arcpy.FeatureSet()
facilities.load("Stores")
demandPoints = arcpy.FeatureSet()
demandPoints.load("TractCentroids")
arcpy.na.SolveLocationAllocation(facilities, demandPoints, "Minutes", 
                                "Streets_ND", "in_memory", "Lines", 
                                "OutFacilities", "OutDemandPoints", 
                                "RouteEdges", Number_of_Facilities_to_Find=2)
SolveLocationAllocation example 2 (stand-alone script)

The following stand-alone Python script demonstrates how to use SolveLocationAllocation through a stand-alone script.

# Name: SolveLocationAllocation_Workflow.py
# Description: Find the two stores that are most convenient to your customers. 
#              The results show which stores were selected and which store is
#              most convenient to each customer location.
# Requirements: Network Analyst Extension

#Import system modules
import arcpy
from arcpy import env

try:
    #Check out the Network Analyst extension license
    arcpy.CheckOutExtension("Network")

    #Set environment settings
    env.workspace = r'C:\arcgis\ArcTutor\Network Analyst\Tutorial\SanFrancisco.gdb'
    env.overwriteOutput = True

    #Set local variables
    inNetworkDataset = r'Transportation\Streets_ND'
    inFacilities = r'Analysis\Stores'
    inDemandPoints = r'Analysis\TractCentroids'
    outGeodatabase = r'C:\arcgis\ArcTutor\Network Analyst\Tutorial\Output.gdb'
    outLines = "Lines"
    outFacilities = "Facilities"
    outDemandPoints = "DemandPoints"
    outRouteEdges = "RouteEdges"
    measurement_units = "Minutes"

    # Run SolveLocationAllocation. Find the best two stores, but don't consider
    # stores beyond a 10 minute travel time for a given customer.
    arcpy.na.SolveLocationAllocation(inFacilities, inDemandPoints, 
                                measurement_units, inNetworkDataset, 
                                outGeodatabase, outLines, outFacilities, 
                                outDemandPoints, outRouteEdges, 
                                Number_of_Facilities_to_Find=2,
                                Default_Measurement_Cutoff=10.0)

    print "Script completed successfully"

except Exception as e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print "An error occured on line %i" % tb.tb_lineno
    print str(e)

Environments

  • Current Workspace
  • Output Coordinate System

Licensing information

  • Basic: Requires Network Analyst
  • Standard: Requires Network Analyst
  • Advanced: Requires Network Analyst

Related topics

  • Location-allocation analysis
  • Output from Solve Location-Allocation

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal