English

How To: Calculate the intercardinal direction from one point to a set of points

Summary

The instructions provided describe a workflow that is intended for situations where a set of points surrounds a main point and the intercardinal (ordinal) direction (NW, NE, SW, SE) must be added as a field to the table.

This is useful when trying to determine the quadrant in which a point, or group of points, lies with respect to a central point.

Procedure

This workflow requires the use of the Generate Near Table tool and Python code in the Field Calculator. This workflow assumes you have two separate point feature classes.

Note:
The Generate Near Table tool requires an Advanced license.

  1. Open the Generate Near Table tool. In ArcToolbox, click Analysis Tools > Proximity > Generate Near Table.
  2. a) Under Input Features select the point feature from which the direction is located.

    b) Under 'Near Features' select the points that surround the input point feature.

    c) Set the desired Search Radius.

    d) Check the Location and Angle boxes.

    e) Uncheck 'Find only closest feature'.

    f) Under 'Method' select PLANAR (optional).

    Note:
    This workflow is intended for use with the Planar option. The Geodesic method produces different results that might not be compatible with this workflow. The Generate Near Table and Near tools have been completely rewritten at ArcGIS version 10.2.1 to be dramatically faster and they now have an optional Method parameter that determines how distances are computed. When Method is set to GEODESIC, distances are calculated across the Earth's surface. This is most accurate when the distance between features is large and you want to minimize the distortion inherent in all projected coordinate systems, particularly in projections like Web Mercator. When set to PLANAR, Euclidean distances are calculated using the coordinates of the features and is appropriate for projections that minimize distance distortion or when the distance between features is small. Please see What's new in ArcGIS 10.2.1.

    g) Click OK to run the tool.

    The tool outputs a table.

  3. a) Open the table by right-clicking the table in the Table of Contents and selecting 'Open'.

    b) Add a new field to the table.
    [O-Image]
    c) Name the field 'Direction' and under Type, select Text, and click OK.
    [O-Image]
  4. Right-click the Direction field, and click Field Calculator.

  5. Under Parser, select Python and check the 'Show Codeblock' checkbox.
    [O-Image]
  6. Add the following code to the Pre-Logic Script Code block:
    Code:
    def Direction(angle):

    if (angle >= 0 and angle <= 90):

    return "NE"

    if (angle >= 90):

    return "NW"

    if (angle >= -90):

    return "SE"

    if (angle <= -90):

    return "SW"

  7. In the second text box add the following code:
    Code:
    Direction(!NEAR_ANGLE!)

  8. Click OK and the result displays the cardinal directions.
    [O-Image]