## Connect Points

Running programmatically

Connects with lines each point from a point dataset to every other point from the same dataset that is closer to the point than the user defined cut off distance.

• Assigns the IDs of the From and To Points to each line.
• Calculates the length and angle of the connector lines.

### Inputs:

• A Point layer
• Cutoff distance - in the units of the spatial reference of the input dataset. Points that are farther to each other than this tolerance will not be connected.
• Max number of points to connect.
• Add duplicate lines. If false only one line will be created between two points closer to each other then the Cutoff distance.

### Outputs:

• New point layer. Fields:
• [ET_From] - the ID of the start point of the line
• [ET_To] - the ID of the end point of the line
• [ET_Length] - the length of the line
• [ET_Angle] - the angle of the line

### Notes:

• If no Cutoff distance tolerance is specified each point will be connected to all other points
• Important: The number of connector lines created if no cutoff distance is used can be calculated using the formulae N = n x (n-1)/2 (N - number of lines, n - number of input points). For example 1,000 points will create 499,500 lines, 10,000 points will create 49,995,000 lines, which is not a dataset you want to handle.

### Example:

• Point 0 connects to Points 1, 2, 3, 4
• Point 1 connects to Points 2, 3, 4 (it already has been connected to Point 0)
• Point 2 connects to Points 3, 4 (it already has been connected to Points 0 and 1)
• ......

The angle is calculated in North Azimuth direction

(Go to TOP)

### Parameters

Expression Explanation
Function Name ConnectPoints
<input dataset> A String representing the input layer. Must be of Point type.
<output dataset> A String - the full name of the output layer.
<Number Neighbours> An Integer representing the maximum number of points to connect to each point.
{CutOff Distance} A Double representing the maximum distance to a neighbor to be connected. The units of the tolerance are the units of spatial reference of the input dataset.
{Add Duplicates} A Boolean indicating whether duplicate lines will be added to the output.

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, "ConnectPoints", "input dataset",  "output dataset", "Number Neighbours", "CutOff Distance", "Add Duplicates"])
.NET using ETGWRun.exe StartInfo.FileName = ETGWPath
StartInfo.Arguments = "ConnectPoints" "input dataset"  "output dataset" "Number Neighbours" "CutOff Distance"  "Add Duplicates"
.NET using ETGWOutX.dll ConnectPoints(input dataset, output dataset, Number Neighbours, CutOff Distance, Add Duplicates)
ArcPy arcpy.ConnectPoints(input dataset, output dataset, Number Neighbours, CutOff Distance,Add Duplicates)

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)