Purpose
Returns an object representing the shortest or longest distance between two objects. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
SphericalConnectObjects( object1, object2, min )
object1 and object2 are object expressions.
min is a logical expression where TRUE calculates the minimum distance between the objects, and FALSE calculates the maximum distance between objects.
Return Value
This statement returns a single section, two-point Polyline object representing either the closest distance (min == TRUE) or farthest distance (min == FALSE) between object1 and object2.
Description
One point of the resulting Polyline object is on object1 and the other point is on object2. Note that the distance between the two input objects can be calculated using the ObjectLen() function. If there are multiple instances where the minimum or maximum distance exists (e.g., the two points returned are not uniquely the shortest distance and there are other points representing "ties") then these functions return one of the instances. There is no way to determine if the object returned is uniquely the shortest distance.
SphericalConnectObjects() returns a Polyline object connecting object1 and object2 in the shortest (min == TRUE) or longest (min == FALSE) way using a spherical calculation method. If the calculation cannot be done using a spherical distance method (e.g., if the MapBasic coordinate system is NonEarth), then this function will produce an error.
See Also:
ConnectObjects() function, CartesianConnectObjects() function, Nearest statement, Farthest statement, CartesianObjectDistance() function, ObjectDistance() function, SphericalObjectDistance() function