Available with Business Analyst license.
Summary
Creates a series of lines from each customer to an associated store location. These lines are often called spider diagrams.
Illustration
Usage
In most cases, the input Store Layer will be a Business Analyst store layer.
The Store Layer must be a point feature class.
In ArcMap, desire lines will only be drawn to customer points that are within the active study area or analysis extent. If you want to draw desire lines to all customer points, make sure that all customers are within the analysis extent.
Creating desire lines with drive time and drive distance will take significantly longer than using the straight-line (Euclidean) distance method.
Check the Add Distance to Customer Layer checkbox if you want to append the distance from the customer point to the associated store location for each customer record.
Only customers in the active extent or study area will be used in this analysis.
Use the Assign By Closest Stores Location or Assign By Trade Area tools in the Customer Setup toolset if your customers are not assigned to a store location.
Syntax
DesireLines_ba (InputFeatureLayer, IDField, All_Or_Single_Or_Selected, CustomerLayer, LinkField, DistanceCalculateMethod, MeasureUnitsForDistanceField, OutputFeatureClass, {ByID_Or_ByName}, {Single_Site}, {UseSelectedFeatures}, {ExcludeOutlyingCustomers}, {CutOffDistance}, {MeasureUnits}, {AddDistanceToBusiness}, {WayToDefineDistanceField}, {DesireLinesDistanceField}, {NameField}, {BarrierFeatureClasses})
Parameter | Explanation | Data Type |
InputFeatureLayer | The input feature layer containing the center points for the desire lines. Desire lines are drawn from these features. | Feature Layer |
IDField | Field used to uniquely identify each store. | Field |
All_Or_Single_Or_Selected | Runs a desire line analysis on one or more stores.
| String |
CustomerLayer | Contains the customer points for the desire lines. Desire lines are drawn from the store to these features. | Feature Layer |
LinkField | The store ID field in the customer layer that assigns each customer to a store. | Field |
DistanceCalculateMethod | The method used to derive length of each desire line.
| String |
MeasureUnitsForDistanceField | The units used with the distance values.
| String |
OutputFeatureClass | The feature class that will contain the desire lines. | Feature Class |
ByID_Or_ByName (Optional) | Field used to select a single point.
| String |
Single_Site (Optional) | ID or name of store that is to be used as the single point. | String |
UseSelectedFeatures (Optional) | Uses only selected features to generate the desire lines.
| Boolean |
ExcludeOutlyingCustomers (Optional) | Allows you to set a cutoff distance to remove outlying points from the analysis.
| Boolean |
CutOffDistance (Optional) | The threshold to exclude outlying customers from the analysis. | Double |
MeasureUnits (Optional) | The units used with the distance values. By default, the units defined in the Business Analyst preferences will be selected.
| String |
AddDistanceToBusiness (Optional) | Adds a new field that will contain the distance calculated to each store for each customer record.
| Boolean |
WayToDefineDistanceField (Optional) | Uses an existing distance field in the customer layer to store the length of each desire line.
| Boolean |
DesireLinesDistanceField (Optional) | The field that will contain the distance calculated in the analysis. | String |
NameField (Optional) | This field contains the store name which is typically in a string format. | Field |
BarrierFeatureClasses [BarrierFeatureClasses,...] (Optional) | Allows a user to place point, line, or polygon barriers when using drive time or drive distance algorithms to calculate distances. | Feature Layer |
Code sample
DesireLines example (stand-alone script)
# Name: DesireLines.py
# Description: Creates a spider diagram between stores and customers in San Francisco using a straight line distance calculation.
# Author: Esri
# Import system modules
import arcview
import arcpy
arcpy.ImportToolbox(r"C:\Program Files (x86)\ArcGIS\Desktop10.6\Business Analyst\ArcToolbox\Toolboxes\Business Analyst Tools.tbx")
try:
# Acquire extension license
arcpy.CheckOutExtension("Business")
# Define the parameters for the Desire Lines tool
InputFeatureLayer = "Default Group Layer/sf_stores"
IDField = "STORE_ID"
All_Or_Single_Or_Selected = "ALL"
CustomerLayer = "Default Group Layer/sf_custs"
LinkField = "STORE_ID"
DistanceCalculateMethod = "STRAIGHT_LINE_DISTANCE"
MeasureUnitsForDistanceField = "Miles"
OutputFeatureClass = "C:\My Output Data\Projects\Default Project\Analyses\DesireLines_4\StoreLayer_DesireLines.shp"
# Create Desire Line output file
arcpy.DesireLines_ba(InputFeatureLayer,
IDField,
All_Or_Single_Or_Selected,
CustomerLayer,
LinkField,
DistanceCalculateMethod,
MeasureUnitsForDistanceField,
OutputFeatureClass)
# Release extension license
arcpy.CheckInExtension("Business")
except:
print arcpy.GetMessages(2)
Environments
This tool does not use any geoprocessing environments.
Licensing information
- ArcGIS Desktop Basic: Requires Business Analyst
- ArcGIS Desktop Standard: Requires Business Analyst
- ArcGIS Desktop Advanced: Requires Business Analyst