Summary
The Solve Location-Allocation tool 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.
Illustration
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
SolveLocationAllocation_na (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})
Parameter | Explanation | Data 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):
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):
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):
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
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.
| 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.
| 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.
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.
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:
| 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.
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:
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:
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.
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:
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) |
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:
| 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
Name | Explanation | Data Type |
Solve_Succeeded | Boolean | |
Output_Allocation_Lines | Feature Class | |
Output_Facilities | Feature Class | |
Output_Demand_Points | Feature Class | |
Output_Route_Edges | Feature Class | |
Output_LocationAllocation_Analysis_Layer | File | |
Output_Route_Analysis_Layer | File |
Code sample
SolveLocationAllocation example 1
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 Python 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
Licensing information
- ArcGIS Desktop Basic: Requires Network Analyst
- ArcGIS Desktop Standard: Requires Network Analyst
- ArcGIS Desktop Advanced: Requires Network Analyst