Hello all!

I cannot find the way how to create a distance matrix from a point layer. If I use the point distance tool from the proximity toolbox I just get a table with the distances between each point within the layer but I need a 1:1 data matrix (rows and columns as points, values as distances and the diagonal with 0 values). There must be certainly a way how to create this…

I need the distance matrix for other calculations.

I am using ArcGIS 10.3.1 for Desktop (Advanced Licence).

Do you have any ideas?

Thanks for four support.

I have posted in my blog a number of times on distance calculations. You can use scipy.distance.cdist to produce a squareform matrix, however, I prefer to use a pure numpy based solution using einsum which does the same trick.

Here is the def from a larger module I maintain.

and here is simple set of data points so you can see how it works

give it a shot. 3D distance can also be determine using einsum notation

You can also use an upper of lower matrix format if you want to make it easier to read