Linear Directional Mean (Spatial Statistics)

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

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
  • DIRECTIONThe From and To node information is ignored.
  • ORIENTATION_ONLYThe From and To nodes are utilized in calculating the mean (default).
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 (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 (stand-alone Python 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"
 
try:
    # 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", "#")
 
except:
    # If an error occurred while running a tool, print the messages 
    print arcpy.GetMessages()

Environments

Output Coordinate System

Feature geometry is projected to the output coordinate system prior to analysis.

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes

3/7/2012