> Script Details
Nearest Features, with Distances and Bearings (v. 3.8b)
report inappropriate content
Mar 15 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 creates a new button on the VIEW toolbar which enables you to identify which comparison features are nearest to some set of input features you are interested in. The extension then creates a results table (described below) containing various user-selected fields such as distance and bearing between features. Optionally, you can request lines to be drawn connecting each input feature with that closest comparison feature and save these lines as a Polyline shapefile.
Multiple Levels of Nearness: This extension allows you to calculate the 1st, 2nd, … nth closest comparison features to each input feature. Distance, bearing, and graphic lines can be calculated for each level of nearness as well.
Centroids vs. Closest Edges: If desired, this extension can calculate the distance and bearing between the centroids of the closest features as well as the distance and bearing between the closest edges of those features. For example, if a point theme and a polygon theme are used in the analysis, then this extension will determine what point on the edge of the closest polygon (not necessarily a vertex) is closest to the input point. If the features intersect or if one lies within the other, then you have the option to either set the distances to zero or not, thereby allowing you to calculate the closest distances to the edge from features enclosed by other features. You can request that graphics be drawn connecting the centroids and/or the closest edges of the closest features and you have the option to save these connecting lines into a separate Polyline shapefile.
Closest Features within a Single Theme: You can select a single theme to act as both the input theme AND comparison theme, in which case this extension will measure the distances from each feature in that theme to all the other features in that theme. It will NOT measure the distance to itself, so you will not get a bunch of zero distances.
** 3.8: August 31, 2004. Added the option to calculate distances and bearings based on geodesic curves over the surface of the spheroid, IF both input and comparison themes are point themes.
** 3.8a: December 3, 2004: Repaired a bug that occurred when you set a maximum search distance, producing a message box stating something like "XXX records selected (12345)" and occasionally causing the extension to crash.
** 3.8b: February 15, 2007: Minor update; adds a function to check for errors in scripts in case of crash.
Online Manual Available: Detailed instructions, explanations and descriptions of updates are included in "Nearest Features.pdf" (in Adobe Acrobat format) or on-line at:
For more ArcView Extensions and other software by the author, please visit the Jenness Enterprises software download page at:
the complete description can be found in the readme.txt file included in the zipfile download.