> Script Details
Distances and Bearings Between Matched Features v. 2.1
report inappropriate content
Sep 5 2007
Status of work
ArcScripts is intended for the free exchange of scripts and tools related to ESRI software products. Please alert the moderator if this script is a demo, trial-version, or an advertisement for a retail product.
DESCRIPTION: This extension calculates the distance and bearing between features with identical attribute values, allowing you to generate connecting lines and calculate data for specific sets of features. Output options include a Results table containing various user-selected fields such as distance and bearing between features, X/Y coordinates, centroids vs. closest edges, etc. You can also generate a polyline shapefile of the lines connecting features or draw graphic connecting lines in the view.
** Geodesic Curves: If your data are in point format and if they are in geographic coordinates (i.e. Latitude/Longitude or “Unprojected”), then you have to option to calculate distances and bearings using geodesic curves (i.e. great circle segments) in order to get the most accurate measures possible.
** Centroids vs. Closest Edges: If desired, this extension can calculate the distance and bearing between the centroids of the Input and Comparison features as well as the distance and bearing between the closest edges of those features. For example, if two polygon themes are used in the analysis, then this extension will determine what points on the edges of the respective polygons (not necessarily vertices) are closest to each other, and calculate the distance and bearing based on these closest points. If the features intersect or if one lies within the other, the distance between edges will be zero but there will still be a calculated value for the distance between centroids. The user can generate graphics connecting the centroids and/or the closest edges of the respective features.
** Add a Record Number Field to Tables: This extension requires that the input and comparison theme attribute tables have a field containing unique ID values that can be used to identify each feature. If such a field is not available, then this extension includes a function to generate a field of record numbers in your table.
The 2.0 update (November 20, 2004) adds the option to generate data and connecting lines between multiple Input features and multiple Comparison features with the same attribute value, and also to generate connecting lines between features in the same theme. Version 2.0 also adds a button to delete any graphics created by this extension and adds a menu item to generate record number fields.
Version 2.1 (September 4, 2007) corrects a bug with the message “Variable ComparisonIDIsString has not been initialized”, and which occurs when the user specifies that only a results table, but no polyline shapefile, should be generated.
More detailed operating instructions may be found in the "Distance By ID.pdf" document, which is in Acrobat PDF format, or on-line at:
For more ArcView Extensions and other software by the author, please visit the author's software download page at:
the complete description can be found in the readme.txt file included in the zipfile download.