Number Features (Defense)

Summary

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

Usage

  • Using an existing field to number will overwrite the values in that field.

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

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

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

Syntax

NumberFeatures(in_features, field_to_number, {in_area}, {spatial_sort_method}, {new_field_type})
ParameterExplanationData Type
in_features

The input features to number.

Feature Set
field_to_number

The input field to number. 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.

  • URSorting starts at the upper right corner. This is the default.
  • ULSorting starts at the upper left corner.
  • LRSorting starts at the lower right corner.
  • LLSorting starts at the lower left corner.
  • PEANOSorting uses a space filling curve algorithm, also known as a Peano curve.
  • NONEA spatial sort will not be used. The same order as the feature class will be used.
String
new_field_type
(Optional)

Specifies the field type of the new field. This parameter is only used when the field name does not exist in the input table.

  • SHORTThe field will be of short type. This is the default.
  • LONGThe field will be of long type.
  • TEXTThe field will be of text type.
String

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.NumberFeatures_defense("Structures", "structure_number", "AO", "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.FeatureToPoint_management("Buildings_1", result_points)

# Number the points that represent buildings
arcpy.NumberFeatures_defense(result_points, "building_number", "AO", "LL", 
                             "Short")

Environments

This tool does not use any geoprocessing environments.

Licensing information

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

Related topics