NOTE: Starting in ArcGIS Desktop 10.2.1, the proximity tools Near and Generate Near Table can measure geodesic distances, so there is no longer a need for the workaround below. You can learn more here: http://desktop.arcgis.com/en/arcmap/latest/tools/analysis-toolbox/analysis-toolbox-history.htm#GUID-FB944CD8-9D92-4146-B6DD-2562F682CCC5

Going back to the very early days of ArcGIS there have been geoprocessing tools for calculating distances between features. Tools like Near, Point Distance, and Buffer have been around for many releases, and perform key analysis in a number of common GIS workflows. These distance-measuring tools have always worked well and calculated very accurate distances for features concentrated in a relatively small area (a city, state, or single UTM zone) with an appropriate projected coordinate system that minimizes distance distortion. Unfortunately, for groups of features spread over larger areas (regions, countries, or the world!), or for datasets with a geographic coordinate system, these tools have historically produced results that were less than perfect.

In the last few releases, and continuing in future releases, more emphasis has been placed on calculating accurate distances for that second scenario: features covering a large area, or datasets with a geographic coordinate system. Some key enhancements are in the works to make distance measurement through geoprocessing better than ever, namely by calculating geodesic distances in the scenarios described above (geodesic distance is the distance measured along the shortest route between two points on the Earth’s surface).

In 10.0 Service Pack 2, an enhancement has been made to enable the calculation of geodesic distance along a line. This is done with a line feature class in a geographic coordinate system using the Calculate Field tool and specifying an expression like !Shape.length@meters! . This functionality can be included in a longer workflow to calculate geodesic distance between points.

The model summarized below produces output similar to the Generate Near Table tool; given Input Points and Near Points datasets, find the geodesic distance from each input point to each near point and record that distance in a new table. You can download this model and sample data from the Geoprocessing Resource Center Model and Script Tool Gallery here, and run the tool with your own point datasets that have a geographic coordinate system (some modification to the model may be required).

Since this geodesic distance calculation relies on the measurement of lines, we need a way to create line features between all input points and near points. The XY To Line tool can be used to accomplish this, but first there are a few steps that must be done to setup the workflow and produce a table that can be used with the **XY To Line** tool. Given that the **XY To Line** tool requires a table of XY coordinates as input, first add XY coordinate information to both the *Input Points* and *Near Points* using the Add XY Coordinates tool.

Next, use the Generate Near Table tool to setup what will become the *Output Table* (note that the NEAR_DIST values produced by the **Generate Near Table** tool are in decimal degrees – not geodesic distances).

After creating the *Output Table*, use the Join Field tool to move the coordinate information from the *Input Points* and *Near Points* to the *Output Table*. Also, a unique identifier field will be required later, so add a new ID field using Add Field and calculate it equal to the *Output Table* ObjectID field using Calculate Field.

Now that the *Output Table* is set up to be used correctly with the **XY To Line** tool (with Start and End coordinates stored in separate fields), run **XY To Line** to create line features between each input point and near point. These will be the lines that can be measured to obtain geodesic distances.

**Output of XY To Line
**

Next, add a new model variable, *Linear Unit*, which can be used to specify the unit in which to calculate the geodesic distance (meters, kilometers, feet, miles, etc.). Then add a new field ‘GEO_DIST’ and calculate it as the geodesic distance along the lines using a calculation expression!Shape.length@%Linear Unit%!, then join these distances back to the *Output Table*. Finally, clean up the *Output Table* by deleting any unnecessary or intermediate fields.

The output of the workflow will look like the table pictured below, where the field GEO_DIST contains the geodesic distance between the points identified in the IN_FID and NEAR_FID fields, in the unit specified in the *Linear Unit *variable. Comparing these geodesic distances to Euclidean distances (based on a Mercator projection) shows how inaccurate distance measurements can be if they are performed in an inappropriate coordinate system or at an inappropriate scale.

Geodesic distances calculated by this model, and Euclidean distances calculated by the **Generate Near Table** tool.

## Commenting is not enabled for this article.