Calculate distance between several points?

I'm working on a project that involves calculating distances between apartments and public transport, which I have as two different point datasets.

For this I have used Point Distance tool in ArcMap. It works if I have only one public transport point, i.e. apartment point data as input and only one public transport point as near feature.

However, since there are so many public transport points I want to be able to use the full point dataset in one go.

I'm looking for individual distances from apartments to every unique public transport point, not an aggregated number. I.e. from apartment A there is X meters to point A and Y meters to point B etc.

There must be some way to perform this at the same time, so I won't have to repeat the same thing over and over.

I also tried the Near tools but I don't think they are suited for the task either.

• Can you please expand on "I get a weird table that isn't interpretable at all"? I would imagine that you're going to get a large result as it will output a new line for every two-point result, and if you have a large number of points the output will be huge. It will be correct though.
– Midavalo
Feb 1, 2017 at 16:46
• It would have been better to write, it doesn't give me the input I thought it would. I'm looking for individual distances from apartments to every unique public transport point, not an aggregated number. I.e. from apartment A there is X meters to point A and Y meters to point B etc. hope it helps you to understand more, thanks for commenting. Feb 1, 2017 at 20:21
• My understanding of the Point Distance tool is that it creates a new row for each distance - row 1 has distance from apartment A to point A, row 2 has distance from apartment A to point B, etc.
– Midavalo
Feb 1, 2017 at 20:27
• Fixed with edit now, thanks. Aha interesting, when I do it I get four columns and the one named distance have a lot of numbers that are hard to interpret. I would like to have it separated by public transport station. Feb 1, 2017 at 20:49

I don't know any way you could do it in base ArcGIS, but in arcpy you should be able to iteratively have the script calculate the distance using Pythagorean theorem, like this pseudocode:

``````for x in Firstset:
for y in secondset:
temp = sqrt((y.xcoord - x.xcoord)**2 + (y.ycoord - x.ycoord))
``````

It'll have to be done with a search cursor, but that's the general idea. You'll have to add a field for each stop and use an update cursor unless you want the result as a table, at which point use Python to output a CSV of the apartment ID and the value for each. I can add more code if you need more clarification!