## Find Closest Point

Running programmatically

Calculates the distance for each point of a point dataset to the closest point from the same dataset. The function produces similar results as the Closest Feature Distance, but uses a robust algorithm and can be applied on datasets containing up to 8 million points.

### Inputs:

• A Point feature layer
• Cutoff distance - the maximum distance to search for neighbor points.

### Outputs:

• A new  Point feature class. The attribute table of the resulting feature class will have three new fields
• [ET_ID] - the ID of the feature
• [ET_Dist] - the distance from the point to the closest point.
• [ET_Closest] - the ID of the closest point.

### Notes:

• If the distance from a point to the closest point is larger than the Cutoff distance then the [ET_Dist] will have a value of 0 and [ET_ Closest] will have a value of -1
• If there are coincident points in the input dataset, only one of the coincident point will be assigned a closest neighbor. The other points in the same location will have values ET_Dist = 1 and ET_Closest = -1
• The bigger the search tolerance is, the slower the process will be
• The distance is calculated in the units of the Spatial Reference of the input dataset

### Running Programmatically

(Go to TOP)

Parameters

Expression Explanation
Function Name FindClosestPoint
<input dataset> A String representing the input layer. Must be of Point type.
<output dataset> A String - the full name of the output layer.
<CutOff Distance< A Double representing the maximum distance between two points to be considered neghbors - in the units of the spatial reference of the input dataset.

### Running the function

ETGWPath used in the table below is the  full path to ETGWRun.exe (E.G. "C:\Program Files\ETSpatial Techniques\ETGeo Wizards\ETGWRun.exe")

Language Syntax
Python subprocess.call([ETGWPath, "FindClosestPoint", "input dataset", "output dataset", "CutOff Distance"])
.NET using ETGWRun.exe StartInfo.FileName = ETGWPath
StartInfo.Arguments = "FindClosestPoint" "input dataset" "output dataset" "CutOff Distance"
.NET using ETGWOutX.dll FindClosestPoint(input dataset, output dataset,CutOff Distance)
ArcPy arcpy.FindClosestPoint(input dataset, output dataset,CutOff Distance)

Notes:

• <> - required parameter

• {} - optional parameter

• See examples for Python , .NET or ArcPy

• The argument separator for StartInfo.Arguments is space. If a string might contain a space, you need to double quote it.

(Go to TOP)