MapInfo Pro

 View Only
  • 1.  Minimum bounding circle

    Posted 10-31-2023 17:44

    So, I was asked a question recently and without going away and writing something in MapBasic etc I couldn't answer it.

    Is there a simple method in MapInfo to find the minimum bounding circle of a region object?



    ------------------------------
    Duncan Stokes
    Corporate Systems Data Manager
    Unison Greater Manchester Police Branch
    MANCHESTER
    ------------------------------


  • 2.  RE: Minimum bounding circle

    Posted 11-02-2023 04:23

    Hi Duncan,

    I came up with the following but it will only give the MBC of the MBR of the polygon:

    First, issue the following in the MapBasic Window:

    Set Distance Units "m"

    (ensure the units string matches that used by your table's coordinate system)

    Then execute the following Select statement (in one of the later versions of MapInfo), to create a circle bounding each region object within table "PolyTable"

    Select t.*, CreateCircle(CentroidX(t.obj), CentroidY(t.obj), sqr((ObjectGeography(t.obj, 3)-CentroidX(t.obj))^2 + (ObjectGeography(t.obj, 4)-CentroidY(t.obj))^2)) Object

     From PolyTable As "t"

      Where str$(obj) = "region"

    Into tab_MBC_of_MBR

    This Select statement uses the ObjectGeography function twice - the first time to retrieve the max X coordinate of the MBR and the second to retrieve the max Y coordinate of the MBR.  These values, plus the Centre coordinates of the MBR and pythagoras' theorem, are used to find the radius of the circle.

    Example:

    Unfortunately, this will create a larger circle than the MBC.  To find the correct MBC is more difficult.  It looks like there are a couple of algorithms to choose from to generate the MBC, but it would require some programming.



    ------------------------------
    James Nolet
    GIS Manager
    Caf Consulting
    Mentone office, VIC, Australia
    ------------------------------



  • 3.  RE: Minimum bounding circle

    Posted 11-03-2023 10:52

    Thanks @James Nolet, an interesting suggestion that may be close to a solution for the individual who asked me the question. As far as I've been able to tell a bit of MapBasic programming is likely to be the ultimate answer for creating the MBC of a region object, implementing one of the common algorithms for this specific problem. However, I'll probably have to get my head around regions with multiple polygons as well.



    ------------------------------
    Duncan Stokes
    Corporate Systems Data Manager
    Unison Greater Manchester Police Branch
    MANCHESTER
    ------------------------------