获得 Business Analyst 许可后可用。
摘要
Creates a series of lines from each customer to an associated store location. These lines are often called spider diagrams.
插图
用法
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.
语法
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})
参数 | 说明 | 数据类型 |
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 (可选) | Field used to select a single point.
| String |
Single_Site (可选) | ID or name of store that is to be used as the single point. | String |
UseSelectedFeatures (可选) | Uses only selected features to generate the desire lines.
| Boolean |
ExcludeOutlyingCustomers (可选) | Allows you to set a cutoff distance to remove outlying points from the analysis.
| Boolean |
CutOffDistance (可选) | The threshold to exclude outlying customers from the analysis. | Double |
MeasureUnits (可选) | The units used with the distance values. By default, the units defined in the Business Analyst preferences will be selected.
| String |
AddDistanceToBusiness (可选) | Adds a new field that will contain the distance calculated to each store for each customer record.
| Boolean |
WayToDefineDistanceField (可选) | Uses an existing distance field in the customer layer to store the length of each desire line.
| Boolean |
DesireLinesDistanceField (可选) | The field that will contain the distance calculated in the analysis. | String |
NameField (可选) | This field contains the store name which is typically in a string format. | Field |
BarrierFeatureClasses [BarrierFeatureClasses,...] (可选) | Allows a user to place point, line, or polygon barriers when using drive time or drive distance algorithms to calculate distances. | Feature Layer |
代码示例
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)
环境
此工具不使用任何地理处理环境。
许可信息
- ArcGIS Desktop Basic: 需要 Business Analyst
- ArcGIS Desktop Standard: 需要 Business Analyst
- ArcGIS Desktop Advanced: 需要 Business Analyst