ConnectObjects() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

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

ConnectObjects( 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.

ConnectObjects() 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 a Cartesian method will be used.

See Also:

SphericalConnectObjects() function, CartesianConnectObjects() function, Nearest statement, Farthest statement, CartesianObjectDistance() function, ObjectDistance() function, SphericalObjectDistance() function