HOW TO
The following instructions describe how to determine the cardinal compass direction of line features. In this article, the below feature class of a downtown city is used.
Note: The Case Field is used to group features for separate linear directional mean computations. When a Case Field is specified, the input line features are first grouped according to case field values, then an output line feature is created for each group. The case field can be of integer, date, or string type. Records with NULL values for the Case Field are excluded from analysis.
def direction(var): if var < 22.5: return "North" if var >= 22.5 and var < 67.5: return "Northeast" if var >= 67.5 and var < 112.5: return "East" if var >= 112.5 and var < 157.5: return "Southeast" if var >= 157.5 and var < 202.5: return "South" if var >= 202.5 and var < 247.5: return "Southwest" if var >= 247.5 and var < 292.5: return "West" if var >= 292.5 and var < 337.5: return "Northwest" if var >= 337.5: return "North"
direction(!CompassA!)
Get help from ArcGIS experts
Download the Esri Support App