MapInfo Pro

 View Only
  • 1.  Farthest extent of buffer

    Posted 09-30-2022 05:29
    Hi,
    I've got a polygon, and a buffer around the polygon.

    I need to figure out the furthest distance from a point on the polygon boundary to a point on the buffer boundary. All suggestions welcome!

    ------------------------------
    Martin Burroughs
    Oldham Council
    ------------------------------


  • 2.  RE: Farthest extent of buffer

    Posted 10-03-2022 08:37

    Martin:
    Look in the Tool Extensions for the Distance Calculator.  "This tool calculates the distance between all the objects in a table or two tables.  It then returns the closest or farthest object(s) and populates the browser window with the results".  I've used it successfully with a table of points and a polygon: I suspect it will work similarly with two polygons.  You may have to save the buffer as a table before doing so, but that's easy enough to do.

    Bob Wright



    ------------------------------
    Robert Wright
    ROBERT WRIGHT
    Shelton CT
    ------------------------------



  • 3.  RE: Farthest extent of buffer

    Employee
    Posted 10-03-2022 09:09
    Edited by Peter Møller 10-03-2022 09:08
    Bob is spot on with his solution above.

    If you only need to do it for two objects, you can also use the ConnectObjects function with the two objects as variables.

    Here's small script that shows how it can be done.

    It reads the first object from a specific table and the first object from the current selection and uses these two objects for the analysis:
    Fetch First From Highways_Buffer_2500m
    Dim oBuffer As Object
    oBuffer = Highways_Buffer_2500m.OBJ

    Fetch First From Selection
    Dim oPolygon As Object
    oPolygon = Selection.OBJ

    Dim oLine As Object
    oLine = ConnectObjects(oBuffer, oPolygon, 0) '0 indicates to use the farthest distance, 1 the shortest

    Print "Distance: " + FormatNumber$(Round(ObjectLen(oLine, "m"), 1)) + " meters"

    Insert Into WindowInfo(FrontWindow(), WIN_INFO_TABLE)
    (OBJ)
    Values (oLine)

    The script does a bit more than necessary as it also inserts the calculated line into the map window. This is purely so that you can control if it looks fine.


    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------