Summary
The most common use case for using 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 new fields whose names are a combination of the in_field name and direction. Direction is abbreviated. For example, if the in_field name is "PageName" the new field names created by the tool would include: "PageName_N", "PageName_NE", "PageName_E", "PageName_SE", "PageName_S", "PageName_SW", "PageName_W" and "PageName_NW". If the in_field name is "MyPoly" the new field names would include: "MyPoly_N", "MyPoly_NE", "MyPoly_E", "MyPoly_SE", "MyPoly_S", "MyPoly_SW", "MyPoly_W" and "MyPoly_NW".
You cannot specify names for the new fields. The tool uses default names, though you can change field names after the tool has been run.
You can use fields from a joined table.
Syntax
CalculateAdjacentFields_cartography (in_features, in_field)
Parameter | Explanation | Data Type |
in_features | Polygon grid index features to be appended with adjacent field data. | Feature Layer |
in_field |
Field whose values will be used to populate adjacent field data. Use actual field names. Do not use field aliases. | Field |
Code Sample
CalculateAdjacentFields tool Example (Python Window)
Create and populate fields identifying adjacent features for a polygon grid feature class.
import arcpy
from arcpy import env
arcpy.env.workspace = "C:\Data\ProjectData.gdb"
arcpy.CalculateAdjacentFields_cartography ("Index", "PageName")
CalculateAdjacentFields tool Example (Stand-alone Python script)
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
- ArcGIS for Desktop Basic: Yes
- ArcGIS for Desktop Standard: Yes
- ArcGIS for Desktop Advanced: Yes