Skip To Content

Linear Directional Mean

Summary

Identifies the mean direction, length, and geographic center for a set of lines.

Learn more about how Linear Directional Mean works

Illustration

Linear Directional Mean illustration

Usage

  • The input must be a line feature class.

  • This tool honors the 3D nature of your point data and will use x, y, and z values in its calculations if z-values are available. Since these results are 3D in nature, they will need to be visualized in a Scene. Be sure that you are running the analysis in a Scene or copy the result layer into a Scene for correct visualization of your analysis results.

  • When the input features are 2D, attribute values for the output line feature include the following:

    • CompassA—The compass angle (clockwise from due north)
    • DirMean—The directional mean (counterclockwise from due east)
    • CirVar—The circular variance (a measure of how much line directions or orientations deviate from the directional mean)
    • AveX and AveY—The mean center X and Y coordinates
    • AveLen—The mean line length

    When the input features are 3D, attribute values for the output line feature include the following:

    • CompassA—The compass angle (clockwise from due north) in the XY plane of the directional mean
    • DirMean—The directional mean (counterclockwise from due east)
    • DirMeanZ—The angle between the XY plane and the directional mean vector
    • SphVar—The spherical variance (a measure of how much line directions or orientations deviate from the directional mean)
    • AveX, AveY and AveZ—The mean center X, Y and Z coordinates
    • AveLen3D—The mean line length calculated in three dimensions
    When a Case Field is specified, it also will be added to the Output Feature Class.

  • Analogous to a standard deviation measure, the circular variance (CirVar) value tells how well the directional mean vector represents the set of input vectors. Circular variances range from 0 to 1. If all the input vectors have the exact same (or very similar) directions, the circular variance is small (near 0). When input vector directions span the entire compass, the circular variance is large (near 1). This measure is given as SphVar for the spherical variance in three dimensions.

  • A Rayleigh test of uniformity is applied to the directional mean. It tells you if the directional mean is significantly different than a uniform distribution. In 2D, a uniform distribution means that the lines are uniformly distributed around the compass. In 3D, a uniform distribution means the lines are uniformly distributed around a sphere. The ZScore and PValue tell you whether you can reject the null hypothesis of circular uniformity. The RefValue is the critical value of the Rayleigh test statistic. UnifTest will contain the text Nonuniform if the null hypothesis was rejected; otherwise, it will contain the text Uniform.

  • 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 will be excluded from analysis.

  • When measuring direction, the tool only considers the first and last points in a line. The tool does not consider all the vertices along a line.

  • Map layers can be used to define the Input Feature Class. When using a layer with a selection, only the selected features are included in the analysis.

  • The Output Features layer is automatically added to the table of contents with default rendering (directional vectors). The rendering applied is defined by a layer file in <ArcGIS Pro>\Resources\ArcToolBox\Templates\Layers. You can reapply the default rendering, if needed, by using the Apply Symbology From Layer tool.

  • When this tool runs, the output feature class is automatically added to the table of contents (TOC) with default rendering (directional vectors). The rendering applied is defined by a layer file in <ArcGIS>/ArcToolbox/Templates/Layers. You can reapply the default rendering, if needed, using the Apply Symbology From Layer tool.

  • Caution:

    When using shapefiles, keep in mind that they cannot store null values. Tools or other procedures that create shapefiles from nonshapefile inputs may store or interpret null values as zero. In some cases, nulls are stored as very large negative values in shapefiles. This can lead to unexpected results. See Geoprocessing considerations for shapefile output for more information.

Syntax

DirectionalMean_stats (Input_Feature_Class, Output_Feature_Class, Orientation_Only, {Case_Field})
ParameterExplanationData Type
Input_Feature_Class

The feature class containing vectors for which the mean direction will be calculated.

Feature Layer
Output_Feature_Class

A line feature class that will contain the features representing the mean directions of the input feature class.

Feature Class
Orientation_Only

Specifies whether to include direction (From and To nodes) information in the analysis.

  • DIRECTIONThe From and To nodes are utilized in calculating the mean. This is the default.
  • ORIENTATION_ONLYThe From and To node information is ignored.
Boolean
Case_Field
(Optional)

Field used to group features for separate directional mean calculations. The case field can be of integer, date, or string type.

Field

Code sample

LinearDirectionalMean example 1 (Python window)

The following Python window script demonstrates how to use the LinearDirectionalMean tool.

import arcpy
arcpy.env.workspace = r"C:\data"
arcpy.DirectionalMean_stats("AutoTheft_links.shp", "auto_theft_LDM.shp", "DIRECTION")
LinearDirectionalMean example 2 (stand-alone script)

The following stand-alone Python script demonstrates how to use the LinearDirectionalMean tool.

# Measure the geographic distribution of auto thefts
 
# Import system modules
import arcpy
 
# Local variables...
workspace = "C:/data"
locations = "AutoTheft.shp"
links = "AutoTheft_links.shp"
standardDistance = "auto_theft_SD.shp"
stardardEllipse = "auto_theft_SE.shp"
linearDirectMean = "auto_theft_LDM.shp"
 
# Set the workspace (to avoid having to type in the full path to the data every time)
arcpy.env.workspace = workspace
 
# Process: Standard Distance of auto theft locations...
arcpy.StandardDistance_stats(locations, standardDistance, "1_STANDARD_DEVIATION")
 
# Process: Directional Distribution (Standard Deviational Ellipse) of auto theft locations...
arcpy.DirectionalDistribution_stats(locations, standardEllipse, "1_STANDARD_DEVIATION")
 
# Process: Linear Directional Mean of auto thefts...
arcpy.DirectionalMean_stats(links, linearDirectMean, "DIRECTION")

Environments

Output Coordinate System

Feature geometry is projected to the output coordinate system prior to analysis. All mathematical computations are based on the output coordinate system spatial reference.

Licensing information

  • ArcGIS Desktop Basic: Yes
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics