Number Features By Sector (Defense)

Summary

Adds a sequential number to a new or existing field of a set of input features based on a geographic grouping to which the features belong.

Usage

  • Adding a sequential number to an existing field will overwrite the values in that field.

  • When naming a new field to number in the Field to Number (Existing or New) parameter, the first letter must be an alpha character, and the remaining letters must be alphanumeric or underscores.

  • Features outside of the Sector Polygons parameter value will automatically set the Field to Number (Existing or New) parameter to Null.

  • When numbering features other than points, all features that are contained in or intersect the Sector Polygons parameter value will be numbered.

  • Each sector starts a new number sequence based on an increment value.

  • The Spatial Sort Method parameter will be inactive if a SortMethod field exists in the Sector Polygons parameter value. Values from the SortMethod field will be used instead. Valid values for the SortMethod field are the following:

    • UR—Features will be sorted starting at the upper right corner.
    • UL—Features will be sorted starting at the upper left corner.
    • LR—Features will be sorted starting at the lower right corner.
    • LL—Features will be sorted starting at the lower left corner.
    • PEANO—Features will be sorted using a space-filling curve algorithm, also known as a Peano curve.
    • CENTER—Features will be sorted starting from a center point (the mean center will be used if no center is supplied).
    • CLOCKWISE—Features will be sorted starting from a center point and moving clockwise.
    • COUNTERCLOCKWISE—Features will be sorted starting from a center point and moving counterclockwise.
    • NONE—No spatial sort will be used. The same order as the feature class will be used.

  • The Increment Sectors By parameter will be inactive, if a StartNumber field exists in the Sector Polygons parameter value. Values from the StartNumber field will be used instead. The StartNumber field type must be Long.

  • The following sort methods do not use a center point and are applied per sector:

    • Upper right
    • Upper left
    • Lower right
    • Lower left
    • Peano curve

  • The following sort methods are applied on a per-sector basis when the Center Point parameter value is not specified:.

    • Center
    • Clockwise
    • Counterclockwise

Parameters

LabelExplanationData Type
Input Features

The input features that will be numbered.

Feature Set
Sector Polygons

The input polygons representing sectors that will be used for numbering.

Feature Set
Field to Number (Existing or New)

The input field that will be numbered. The field can be an existing short, long, or text field, or a new field.

Field
Field Type For New Field
(Optional)

Specifies the field type that will be used for the new field. This parameter is only used when the field name does not exist in the input table.

  • ShortThe field type will be short. This is the default.
  • LongThe field type will be long.
  • TextThe field type will be text.
String
Spatial Sort Method
(Optional)

Specifies how features will be spatially sorted for the purpose of numbering. Features are not reordered in the table.

  • Upper rightFeatures will be sorted starting at the upper right corner. This is the default.
  • Upper leftFeatures will be sorted starting at the upper left corner.
  • Lower rightFeatures will be sorted starting at the lower right corner.
  • Lower leftFeatures will be sorted starting at the lower left corner.
  • Peano curveFeatures will be sorted using a space-filling curve algorithm, also known as a Peano curve.
  • CenterFeatures will be sorted starting from a center point (the mean center will be used if no center is provided).
  • ClockwiseFeatures will be sorted starting from a center point and moving clockwise.
  • CounterclockwiseFeatures will be sorted starting from a center point and moving counterclockwise.
  • NoneNo spatial sort will be used. The same order as the feature class will be used.
String
Increment Sectors By
(Optional)

The value that will be used to increment by from the previous sector.

Long
Center Point
(Optional)

The center point that will be used to sort and number features.

Feature Set
Add Distance and Bearing to Center
(Optional)

Specifies whether fields will be added to the output for distance and bearing to a center point.

  • Do not add distance and bearingNo distance or bearing fields will be added to the output. This is the default.
  • Add distance and bearingDIST_TO_CENTER and ANGLE_TO_CENTER fields will be added to the output.
Boolean

Derived Output

LabelExplanationData Type
Output Feature Class

The updated feature class.

Feature Class

arcpy.defense.NumberFeaturesBySector(in_features, sector_polygons, field_to_number, {new_field_type}, {spatial_sort_method}, {increment_by}, {center_point}, {add_distance_and_bearing})
NameExplanationData Type
in_features

The input features that will be numbered.

Feature Set
sector_polygons

The input polygons representing sectors that will be used for numbering.

Feature Set
field_to_number

The input field that will be numbered. The field can be an existing short, long, or text field, or a new field.

Field
new_field_type
(Optional)

Specifies the field type that will be used for the new field. This parameter is only used when the field name does not exist in the input table.

  • SHORTThe field type will be short. This is the default.
  • LONGThe field type will be long.
  • TEXTThe field type will be text.
String
spatial_sort_method
(Optional)

Specifies how features will be spatially sorted for the purpose of numbering. Features are not reordered in the table. If a SortMethod field exists in the sector_polygons input, that value will be used instead.

  • URFeatures will be sorted starting at the upper right corner. This is the default.
  • ULFeatures will be sorted starting at the upper left corner.
  • LRFeatures will be sorted starting at the lower right corner.
  • LLFeatures will be sorted starting at the lower left corner.
  • PEANOFeatures will be sorted using a space-filling curve algorithm, also known as a Peano curve.
  • CENTERFeatures will be sorted starting from a center point (the mean center will be used if no center is provided).
  • CLOCKWISEFeatures will be sorted starting from a center point and moving clockwise.
  • COUNTERCLOCKWISEFeatures will be sorted starting from a center point and moving counterclockwise.
  • NONENo spatial sort will be used. The same order as the feature class will be used.
String
increment_by
(Optional)

The value that will be used to increment by from the previous sector. If a StartNumber field exists in the sector_polygons input, that value will be used instead.

Long
center_point
(Optional)

The center point that will be used to sort and number features.

Feature Set
add_distance_and_bearing
(Optional)

Specifies whether fields will be added to the output for distance and bearing to a center point.

  • DONT_ADD_DISTANCENo distance or bearing fields will be added to the output. This is the default.
  • ADD_DISTANCEDIST_TO_CENTER and ANGLE_TO_CENTER fields will be added to the output.
Boolean

Derived Output

NameExplanationData Type
out_feature_class

The updated feature class.

Feature Class

Code sample

NumberFeaturesBySector example 1 (Python window)

The following Python window script demonstrates how to use the NumberFeaturesBySector function.

import arcpy
arcpy.env.workspace = r"C:/Data.gdb"
arcpy.NumberFeaturesBySector_defense("bldg_footprints", "sectors", "bldg_number")
NumberFeaturesBySector example 2 (stand-alone scripts)

The following example uses the NumberFeaturesBySector function in an example workflow script.

# Assign buildings a number based on their sector and export the first building in sector 700

# Import modules
import arcpy

# Set workspace
arcpy.env.workspace = r"C:/Data.gdb"

# Number the buildings by sector
arcpy.NumberFeaturesBySector_defense("bldg_footprints",
                                     "sectors",
                                     "bldg_number",
                                     "LONG",
                                     "CENTER",
                                     100,
                                     "neighborhood_center",
                                     "DONT_ADD_DISTANCE")

# Select the first building in sector 700
select_from = "bldg_footprints"
expression = "bldg_number = 700"
arcpy.SelectLayerByAttribute_management(select_from,
                                        "NEW_SELECTION",
                                        expression)

# Export to new feature class
arcpy.FeatureClassToFeatureClass_conversion(select_from,
                                            arcpy.env.workspace,
                                            "bldg700")

Licensing information

  • Basic: No
  • Standard: No
  • Advanced: Yes

Related topics