# Point-to-point Link

I have a point layer of 64 points.

Now I want a point-to-point linkage line layer containing 64*64=4096 lines.

Is there a way automatically do that?

• Not really, you can connect the points to the closest points using a TIN if you have 3d analyst. With a bit of python it could be done.. BTW it's not 4096 as you don't connect to the same point, it should be 3969 at most. Do you have any python ability? – Michael Stimson Mar 21 '16 at 22:24
• I came up with an approach myself. Please check it if interested. Thank you for your answer. – PacmanKX Mar 21 '16 at 22:39

## 1 Answer

Actually I've come up with an approach myself. It's a little bit tricky.

First, use "Point Distance" tool to create a point-to-point matrix. There will be "Input_ID" and "Near_ID".

Second, in the matrix, create "From_Lat", "From_Lon", "To_Lat", "To_Lon", representing the XY coordinates of each link line's start and end point.

Third, join the point layer to the matrix table that point ID matches "Input_ID". Then calculate "From_Lat" and "From_Lon" equal to the point layer's lat and lon.

Forth, de-join and re-join. This time point ID matches "Near_ID" and similarly, calculate "To_Lat" and "To_Lon".

Last, now we have the coordinates for start and end point. Simply run "XY to Line" tool and bingo, we have the link line layer with 64*64-64=4032 line features.

• That was my first thought too but you will end up with 64 0-length lines, use Repair Geometry to remove these if it's going to be a problem, this approach only works if you have an advanced license level but a pythonic approach could be done with any license level... still, it's a way and worth +1. – Michael Stimson Mar 21 '16 at 23:01