Closest Point
Scripts on this page are available here:
The example script ClosestPoint.js contains a function that returns the closest point with name and distance from an input point.

Fig. 35 The figure is showing the result of running the example script. The input point is shown in red. The closest point in this case is Point2.