com.esri.arcgis.geoprocessing.tools.spatialstatisticstools
Class AverageNearestNeighbor
java.lang.Object
com.esri.arcgis.geoprocessing.AbstractGPTool
com.esri.arcgis.geoprocessing.tools.spatialstatisticstools.AverageNearestNeighbor
- All Implemented Interfaces:
- GPTool
- public class AverageNearestNeighbor
- extends AbstractGPTool
Calculates a nearest neighbor index based on the average distance from each feature to its nearest neighboring feature.
The Average Nearest Neighbor tool is contained in the Spatial Statistics Tools tool box.
Learn more about how Average Nearest Neighbor Distance works
Software restrictions: none
Illustration:
Usage tips:
- The nearest neighbor index is expressed as the ratio of the observed distance divided by the expected distance. The expected distance is the average distance between neighbors in a hypothetical random distribution. If the index is less than 1, the pattern exhibits clustering; if the index is greater than 1, the trend is toward dispersion or competition.
- The Z score value is a measure of statistical significance which tells us whether or not to reject the null hypothesis. In this case the null hypothsis states that the points are randomly distributed. In this tool, the Z Score is based on Randomization Null Hypothesis computation. For more information on Z Scores, see What is a Z Score?;
- If an area value is not specified, then the area of the minimum enclosing rectangle around the features is used. The nearest neighbor function is very sensitive to the area value (small changes in the area can result in considerable changes in the results).
- The units of the area parameter are the input feature class' coordinate system's units squared.
- Although this tool will work with polygon or line data, it is really only appropriate for event, incident, or other fixed-point feature data. For line and polygon features, feature centroids are used in the computations.
- When output is shown graphically, a separate graphics dialog box will be displayed. Therefore, the output should not be displayed graphically (set display_output_graphically to FALSE) in batch operations.
- When using the tool in scripting, use "false" for the Display Output Graphically parameter. If you do not select false, the popup graphic will appear and your script will not complete until you click"Close".
- The nearest neighbor index and associated Z score values are written to the command window and passed as derived output.
- Calculations are based on either Euclidean or Manhattan distance and require projected data to accurately measure distances.
- Current map layers may be used to define the input feature class. When using layers, only the currently selected features are used.
- The "Display Output Graphically" parameter will only work on the windows operating system. When set to true it will display the results of the tool graphically.
- Learn more about working with layers and table views;
- The environment settings do not have an effect on this tool.
|
Constructor Summary |
AverageNearestNeighbor()
Creates the Average Nearest Neighbor tool with defaults. |
AverageNearestNeighbor(java.lang.Object inputFeatureClass,
java.lang.String distanceMethod)
Creates the Average Nearest Neighbor tool with the required parameters. |
|
Method Summary |
double |
getArea()
Returns the Area parameter of this tool . |
java.lang.String |
getDisplayOutputGraphically()
Returns the Display Output Graphically parameter of this tool . |
java.lang.String |
getDistanceMethod()
Returns the Distance Method parameter of this tool . |
java.lang.Object |
getInputFeatureClass()
Returns the Input Feature Class parameter of this tool . |
double |
getNNRatio()
Returns the NNRatio parameter of this tool (Read only). |
double |
getNNZScore()
Returns the NNZScore parameter of this tool (Read only). |
java.lang.String |
getToolboxAlias()
Returns the alias of the tool box containing this tool. |
java.lang.String |
getToolboxName()
Returns the name of the tool box containing this tool. |
java.lang.String |
getToolName()
Returns the name of this tool. |
void |
setArea(double area)
Sets the Area parameter of this tool . |
void |
setDisplayOutputGraphically(java.lang.String displayOutputGraphically)
Sets the Display Output Graphically parameter of this tool . |
void |
setDistanceMethod(java.lang.String distanceMethod)
Sets the Distance Method parameter of this tool . |
void |
setInputFeatureClass(java.lang.Object inputFeatureClass)
Sets the Input Feature Class parameter of this tool . |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
AverageNearestNeighbor
public AverageNearestNeighbor()
- Creates the Average Nearest Neighbor tool with defaults.
Initializes the array of tool parameters with the default values specified when the tool was created.
AverageNearestNeighbor
public AverageNearestNeighbor(java.lang.Object inputFeatureClass,
java.lang.String distanceMethod)
- Creates the Average Nearest Neighbor tool with the required parameters.
Initializes the array of tool parameters with the values as specified for the required parameters and with the default values for the other parameters.
- Parameters:
inputFeatureClass - Feature Layer, the point feature class for which the average nearest neighbor distance will be calculated.distanceMethod - String, specifies how distances are calculated in the nearest neighbor calculation.-
Euclidean (as the crow flies)—The straight-line distance between two points.
-
Manhattan (city block)—The distance between two points measured along axes at right angles. Calculated by summing the (absolute) differences between point coordinates.
getInputFeatureClass
public java.lang.Object getInputFeatureClass()
- Returns the Input Feature Class parameter of this tool .
This parameter is Feature Layer, the point feature class for which the average nearest neighbor distance will be calculated.
This is a required parameter.
- Returns:
- the Input Feature Class
setInputFeatureClass
public void setInputFeatureClass(java.lang.Object inputFeatureClass)
- Sets the Input Feature Class parameter of this tool .
This parameter is Feature Layer, the point feature class for which the average nearest neighbor distance will be calculated.
This is a required parameter.
- Parameters:
inputFeatureClass - Feature Layer, the point feature class for which the average nearest neighbor distance will be calculated.
getDistanceMethod
public java.lang.String getDistanceMethod()
- Returns the Distance Method parameter of this tool .
This parameter is String, specifies how distances are calculated in the nearest neighbor calculation.
This is a required parameter.
- Returns:
- the Distance Method
setDistanceMethod
public void setDistanceMethod(java.lang.String distanceMethod)
- Sets the Distance Method parameter of this tool .
This parameter is String, specifies how distances are calculated in the nearest neighbor calculation.
This is a required parameter.
- Parameters:
distanceMethod - String, specifies how distances are calculated in the nearest neighbor calculation.-
Euclidean (as the crow flies)—The straight-line distance between two points.
-
Manhattan (city block)—The distance between two points measured along axes at right angles. Calculated by summing the (absolute) differences between point coordinates.
getDisplayOutputGraphically
public java.lang.String getDisplayOutputGraphically()
- Returns the Display Output Graphically parameter of this tool .
This parameter is String, specifies whether the tool will display the nearest neighbor index graphically.
This is an optional parameter.
- Returns:
- the Display Output Graphically
setDisplayOutputGraphically
public void setDisplayOutputGraphically(java.lang.String displayOutputGraphically)
- Sets the Display Output Graphically parameter of this tool .
This parameter is String, specifies whether the tool will display the nearest neighbor index graphically.
This is an optional parameter.
- Parameters:
displayOutputGraphically - String, specifies whether the tool will display the nearest neighbor index graphically.-
True—The output will be displayed graphically.
-
False—The output will not be displayed graphically.
getArea
public double getArea()
- Returns the Area parameter of this tool .
This parameter is Double, the area of the nearest neighbor analysis. The default area value is the area of the minimum enclosing rectangle. The units of this parameter are the input feature class' coordinate system's units squared.
This is an optional parameter.
- Returns:
- the Area
setArea
public void setArea(double area)
- Sets the Area parameter of this tool .
This parameter is Double, the area of the nearest neighbor analysis. The default area value is the area of the minimum enclosing rectangle. The units of this parameter are the input feature class' coordinate system's units squared.
This is an optional parameter.
- Parameters:
area - Double, the area of the nearest neighbor analysis. The default area value is the area of the minimum enclosing rectangle. The units of this parameter are the input feature class' coordinate system's units squared.
getNNRatio
public double getNNRatio()
- Returns the NNRatio parameter of this tool (Read only).
This is an derived parameter.
- Returns:
- the NNRatio
getNNZScore
public double getNNZScore()
- Returns the NNZScore parameter of this tool (Read only).
This is an derived parameter.
- Returns:
- the NNZScore
getToolName
public java.lang.String getToolName()
- Returns the name of this tool.
- Returns:
- the tool name
getToolboxName
public java.lang.String getToolboxName()
- Returns the name of the tool box containing this tool.
- Returns:
- the tool box name
getToolboxAlias
public java.lang.String getToolboxAlias()
- Returns the alias of the tool box containing this tool.
- Returns:
- the tool box alias