Create Territories (Territory Design)
Summary
Tool creates new Territories at specified Solution on selected territory level.
Usage
-
Territory Level must be at format: Level_Name[Level_Index]
Balancing Variables should be specified (via UI or SetupBalancingVariables_TD tool) for creating balanced territories
Seed Points layer must be specified for creating territories from locations (with NUMBER_OF_SEED_POINTS value of in_territories_number_option parameter)
Names Table must be specified for creating territories (with NUMBER_OF_IMPORTED_NAMES value of in_territories_number_option parameter)
Capacity constraints must be specified (via UI or SetupCapacityConstraints_TD tool) before creating territories (with OPTIMAL_BY_CAPACITY value of in_territories_number_option parameter)
Distance constraints (see Minimum Distance and Minimum Distance Between Centers parameters) must be specified (via UI or SetupDistanceConstraints_TD tool) before creating territories (with OPTIMAL_BY_DISTANCE value of in_territories_number_option parameter)
in_territories_number parameter is used only if USED_DEFINED value of in_territories_number_option parameter specified
Value of in_territories_number parameter must be greater than zero
Density influence can be specified only for CREATE_FROM_CENTERS_OF_DENSITY value of in_additional_territories_option parameter. With higher values a territory will be placed at more dense area
Point or Multipoint layers can be used for Seed Points Layer parameter (in_seed_points)
in_name_table and in_name_field parameters must be specified or omitted together
Syntax
Parameter | Explanation | Data Type |
in_territory_solution_layer |
Territory Solution layer to create territories | GP TD Layer |
in_level |
Territory level | String |
in_remove_existing_territories |
Specified Territory level can contains some territories.
| Boolean |
in_territories_number_option |
Number of creating territories can be defined automatically or specified by user.
| String |
in_territories_number (Optional) |
Number of territories to create | Long |
in_additional_territories_option (Optional) |
This option can be used to build territories around optimally placed virtual centers or around centers of density of base level.
| String |
in_summary_attribute (Optional) |
Territories can be calculated using the geographic locations of each geography element, or based on summary value assigned to each geography element. This parameter is used to specify field of base level to calculate territories. Set empty value for using spatial locations only. | Field |
in_density_influence (Optional) |
Density influence for locating territories. Value can be an integer number from 0 to 100 | Long |
in_seed_points (Optional) |
Seed Points layer | Feature Layer |
in_name_table (Optional) |
New created territories can import their names from Name Table. Set empty value for default naming according ATDConfig.xml content | Table |
in_name_field (Optional) |
Field of Name Table used for import territory names | Field |
in_unique_names (Optional) |
All or unique names can be imported from Name Table
| Boolean |
in_autofill_extent (Optional) |
This parameter ensures that all unassigned polygons will be added to their closest territories regardless of the constraint parameters. This option may affect the assigned parameters in order to include all territories in the solution.
| Boolean |
in_override_constraints (Optional) |
This parameter ensures that all created territories exceeds constraints will not be automatically removed. It can be useful for finding reasons of creating less number of territories than required (for example, if constraints are opposite each other).
| Boolean |
Code Sample
The following Python window script demonstrates how to use the tool in immediate mode.
import arcgisscripting
gp = arcgisscripting.create()
gp.CreateTerritories_TD("new layer", "Territories", "REMOVE_TERRITORIES", "USER_DEFINED", 40, "CREATE_FROM_CENTERS_OF_DENSITY", "TOTPOP_CY", 50, "Points20.lyr", "esri_zip5", "NAME", "ALL_NAMES", "DO_NOT_AUTO_FILL_EXTENT", "DO_NOT_OVERRIDE_CONSTRAINTS")
The following stand-alone script demonstrates how to use the tool.
# Import system modules
import arcgisscripting
gp = arcgisscripting.create()
# Set local variables
solution = "new layer"
level = "Territories"
removeTerritories = "REMOVE_TERRITORIES"
numberOption = "USER_DEFINED"
territoriesNumber = 40
additionalTerritoriesOption = "CREATE_FROM_CENTERS_OF_DENSITY"
summaryAttribute = "TOTPOP_CY"
densityInfluence = 50
seedPoints = "Points20.lyr"
nameTable = "esri_zip5"
nameField = "NAME"
uniqueNames = "ALL_NAMES"
autoFillExtent = "DO_NOT_AUTO_FILL_EXTENT"
overrideConstraints = "DO_NOT_OVERRIDE_CONSTRAINTS"
# Execute tool
gp.CreateTerritories_TD(solution, level, removeTerritories, numberOption, territoriesNumber, additionalTerritoriesOption, summaryAttribute, densityInfluence, seedPoints, nameTable, nameField, uniqueNames, autoFillExtent, overrideConstraints)