Summary
Creates fields and calculates values for the neighboring pages (polygon) of a grid polygon feature class.
The most common use case for this tool is to populate fields that can be used to label the adjacent pages in a map book. This tool appends eight new fields (each field representing one of the eight points of the compass: North, Northeast, East, Southeast, South, Southwest, West, and Northwest) to the input feature class and calculates values that identify the adjacent (neighboring) polygons, in each cardinal direction, for each feature in the input feature class.
Usage
This tool creates eight fields whose names are a combination of the Field Name value and direction. The direction is abbreviated. For example, if the Field Name value is PageName, the new field names created by the tool would be PageName_N, PageName_NE, PageName_E, PageName_SE, PageName_S, PageName_SW, PageName_W, and PageName_NW. If the Field Name value is MyPoly, the new field names would be MyPoly_N, MyPoly_NE, MyPoly_E, MyPoly_SE, MyPoly_S, MyPoly_SW, MyPoly_W, and MyPoly_NW.
The tool uses default names for new fields. The field names can be altered after the tool has run.
You can use fields from a joined table.
Syntax
CalculateAdjacentFields(in_features, in_field)
Parameter | Explanation | Data Type |
in_features | The polygon grid index features that will be appended with adjacent field data. | Feature Layer |
in_field |
The field whose values will be used to populate adjacent field data. | Field |
Derived Output
Name | Explanation | Data Type |
out_features | The updated feature class with adjacent field data. | Feature Layer |
Code sample
Create and populate fields identifying adjacent features for a polygon grid feature class.
import arcpy
arcpy.env.workspace = "C:\Data\ProjectData.gdb"
arcpy.CalculateAdjacentFields_cartography ("Index", "PageName")
Create and populate fields identifying adjacent features for a polygon grid feature class.
# Name: calculateadjacentfields_example.py
# Description: Create and populate fields identifying adjacent features for a
# regular polygon grid feature class
# Author: ESRI
# Import system modules
import arcpy
from arcpy import env
# Set environment settings
arcpy.env.workspace = "C:\Data\ProjectData.gdb"
# Set local variables
inFeatures = "MyPolygonIndex"
inField = "PageName"
# Execute CalculateAdjacentFields
arcpy.CalculateAdjacentFields_cartography (inFeatures, inField)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes