Number Features (Defense)

Summary

Adds a sequential number to a new or existing field of a set of input features.

Usage

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

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

  • 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.

  • When numbering features other than points, all features that are contained in or intersect the Input Area to Number parameter value will be numbered.

Parameters

LabelExplanationData Type
Input Features

The input features that will be numbered.

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
Input Area to Number
(Optional)

The area that will limit the features to number; only features within this area will be numbered.

Feature Set
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
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
Starting With
(Optional)

The value that will be used to begin numbering.

Long
Increment By
(Optional)

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

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.NumberFeatures(in_features, field_to_number, {in_area}, {spatial_sort_method}, {new_field_type}, {starting_number}, {increment_by}, {center_point}, {add_distance_and_bearing})
NameExplanationData Type
in_features

The input features that will be numbered.

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
in_area
(Optional)

The area that will limit the features to number; only features within this area will be numbered.

Feature Set
spatial_sort_method
(Optional)

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

  • 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
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
starting_number
(Optional)

The value that will be used to begin numbering.

Long
increment_by
(Optional)

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

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

NumberFeatures example 1 (Python window)

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

import arcpy
arcpy.env.workspace = r"C:/Data.gdb"
arcpy.defense.NumberFeatures("Structures", "structure_number", None, "LL", 
                             "SHORT")
NumberFeatures example 2 (stand-alone script)

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

# Convert building footprints to points and number the points.

# Import modules
import arcpy

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

# Get building center points
result_points = "Building_Points"
arcpy.management.FeatureToPoint("Buildings_1", result_points)

# Number the points that represent buildings
arcpy.defense.NumberFeatures(result_points,
                             "building_number",
                             None,
                             "CENTER",
                             "TEXT",
                             25,
                             5,
                             "center_bldg",
                             "ADD_DISTANCE")