
How Do You Calculate the Distance Between Points?Problem: You have a set of points (in this example around 220 points, representing different locations). You'd like to know the best way to calculate the distance between points found in this layer and a specific point (other than using the measure tool). i.e. If these points represent cities, you need to know the distance between each of the cities and the capital, for example. Here we illustrate three ways to accomplish this:
Steps for the ArcGIS ArcView LicenseHere are the steps for #1 (for ArcGIS w/ArcView License): 1. Download Hawth’s Tools from: http://www.spatialecology.com/htools/download.php 2. Unzip the file 3. Double click on htools_setup.exe to install the tool 4. Open Arcmap 5. Go to View – Toolbars and turn on Hawth’s Tools. You can drag the toolbar anywhere you want. 6. Add your point layer (in this example it is idaho_cities.shp but it could be any point layer) to the map. 7. First you want to query out the Capital: Selection – Select by Attributes
In this example we’ll use Boise:
Click OK and Close. Next you will save Boise as a Shapefile: Right click on the layer (in the Table of Contents) – Data – Export Data:
Name the Shapefile Boise.shp (Instead of Export_Output.shp) & Click OK:
Click “Yes” to add the Boise Shapefile to your map:
Go to Hawth’s Tools – Analysis Tools – Distances Between Points (Between Layer)
Click on the folder icon and give the output file a meaningful (but not too long) name:
Click Ok to run the Tool.
Next navigate to the folder where you saved the output above. Open the file in Excel and you will see a report of the distance between Boise & each city:
Optional: You could join this table to the Idaho Cities Shapefile in ArcMap and symbolize on distance from Boise:
1. Save file as .dbf:
Click “Yes” when prompted:
Right-click on the Idaho Cities layer (in the Table of Contents) – Joins and Relates – Join…
Set up your Join:
When prompted to create an Index, Click “Yes”:
Double-Click on Idaho Cities (or Right-Click – Properties) and Click on Symbology Tab:
You can adjust the ranges if you would like – Just type in the Range & the field will become editable:
Your map will look something like this:
Note: Be careful with Joining data with duplicate names. ArcMap will join the first record it finds when doing a one to many join. In this case there are 2 cities named “Eagle” and 2 named “Pinehurst”. To fix these records you would need to do some manual editing to give these records unique names (Eagle_1 and Eagle_2 for example) and rerun the process. |