[GIS] MapInfo “distance calculator” furthest distance between polygons give same answer as closest

mapinfo

I got 2 layers, each layer containing 1 polygon.

When I use the "Distance Calculator" tool set to find closest point, OR Find farthest point, the result is always the same.

What I want to know is why? How does the tool calculate the "furthest distance"?

If you look at the image here, to me the furhest distance should be calculated between A and B.

Image visualizing the question

Best Answer

In the MapBasic Reference Guide, the Farthest statement's (which I'm going to assume is what the Distance Calculator uses) purpose is defined as:

Find the object in a table that is farthest from a particular object. The result is a two-point Polyline object representing the farthest distance.

So, the title is a little bit misleading, but it is actually finding the furthest object, not the furthest point within the object. This is then corroborated further down in the Description section:

The types of the objects in the fromtable and totable can be anything except Text objects. For example, if both tables contain Region objects, then the minimum distance between Region objects is found, and the two-point Polyline object produced represents the points on each object used to calculate that distance.

Note the part stating the minimum distance between region objects is found.

If you want to find the furthest point within each object, then I think you are going to need to use some code to compare each node in one object against every other node in the other object and then return the distance for the pair of nodes which are furthest apart. It should be fairly simple to implement if you know a bit of MapBasic but otherwise I'm not sure how you'd go about it!

** update ** I've just checked the source code for the Distance Calculator tool and it does indeed use the Farthest statement to do the distance calculation.

Related Question