# Calculating distance between points using ArcGIS Desktop?

I want to write Python syntax to calculate the distance from point to other points in the water network and so on for others, I have 21 points.

I need distances have to follow the network

That means I will have 441 records.

I don’t want to use route method it’s not useful.

• Would you be able to edit your Question to make it clear whether you are using ArcGIS Desktop 10.0 and wish to use ArcPy to calculate the distance between all pair combinations of 21 points? If so, what data format are these points stored in?
– PolyGeo
Jun 9, 2014 at 21:37
• I’m using ArcGIS desktop 10.0 , I don’t know how to use arcpy, the point store in a shape file its system valves and fire hydrants points for water network
– suad
Jun 9, 2014 at 21:57
• Are you wanting distances between points on the network or in the network? In other words, do your distances have to follow the network or just be straight line between points? These are two very different answers, one of which has been given (on). The other (in) is creating a OD Cost Matrix. Also, to clarify, ArcPy is simply a prewritten function library. Without them you will have significantly more Python code to write. You say you don't want to use the route method, which implies distance along the network doesn't matter. Jun 10, 2014 at 0:54
• i need distances have to follow the network
– suad
Jun 10, 2014 at 8:24
• You should edit your original question using the link at the bottom-left of the question to include all of the information you have provided in various comments. @mapperz may re-open the question at that point (or perhaps just your recent comment is sufficient). At any rate this is a network analysis problem. With appropriate licenses it could be solved with an OD cost matrix analysis. There are code samples in various help files related to that process you could start from. Coding from scratch is another matter. Jun 10, 2014 at 21:46

## 3 Answers

Within ArcGIS 10.0 you can just use the Point Distance Tool (Analysis Tools > Proximity > Point Distance). Simply use the same point feature class for the input and near feature class inputs.

• if i want to use it with arcgis 10.2.1
– suad
Jun 9, 2014 at 22:33
• Your question has arcgis-10.0 tag on it!! But this tool should be available at 10.2.1 as well. Jun 9, 2014 at 22:34
• @suad you know how software versioning works, right..... Jun 9, 2014 at 22:40

If you need distances along the network (in your case water network), you have to use network analysis (which you probably did as you are talking about the route method) and the type of analysis for you is one of the following:

• OD Cost Matrix if you just need the numerical expression of the distance. This will automatically calculate pairwise distances along the network between the specified point locations and output them as attributes of a line feature class it creates.
• Closest Facility if you want the exact routes along which the distances are obtained. Using this, you need to load the entire point feature class into both the Facilities and Incidents sublayer.

If you are only wanting to find the nearest you can use Near. Note also that the Point Distance tool has a maximum search distance as an optional parameter which should be set to the maximum distance from a valve to a hydrant you'd consider.

In the same sort of thing is generate near table which can be substituted for either. You can tell it to stop at the first, or keep searching and give all matches within a distance. This tool also works with lines and polygons - for future reference.

These tools have been present from 9.something and should be in ArcGis 10.2.1 (They are in 10.2). To find them open the search tab in either Catalog or Map and type their names... works well if you remember what they're called.