MapInfo Pro

 View Only
  • 1.  Thinning overlapping polygons

    Posted 03-28-2019 16:20
      |   view attached
    Hey all,

    was wondering if anyone knows if it's possible to use the node thinning functionality on overlapping polygons, where it essentially maintains the integrity/structure of each of the polygons themselves.

    I've attached a sample of the polygons I'm using.

    Thanks!

    ------------------------------
    Stefan Bonitatibus
    PITNEY BOWES SOFTWARE, INC
    Shelton CT
    ------------------------------

    Attachment(s)

    zip
    Test_Polys.zip   32 KB 1 version


  • 2.  RE: Thinning overlapping polygons

    Employee
    Posted 03-29-2019 03:35
    @Tony Maber @Peter Møller can you help my Canadian PB ​​​friend and colleague?

    Regards, 
    Kolt

    ------------------------------
    Kolt Luty
    Director - Telco Solutions (Australia)
    PITNEY BOWES SOFTWARE, INC
    ------------------------------



  • 3.  RE: Thinning overlapping polygons

    Employee
    Posted 04-02-2019 07:59
    Hi Stefan,

    I'm not exactly sure what mean by "integrity/structure of each of the polygons themselves"?

    But, the thinning tool is designed to respect common borders so if two boundaries share a common border, the nodes removed will be the same nodes on the border in the two polygons.

    To make this work, you need to select all the records and use the thinning tool on all objects in the same process.

    Let me know if this answers your question. If not share some more details on what you are looking for

    Thanks

    ------------------------------
    Peter Horsbøll Møller
    Pitney Bowes
    ------------------------------



  • 4.  RE: Thinning overlapping polygons

    Posted 04-03-2019 18:24
    Hi Peter/Stefan

    I think the issue here is that they are overlapping polygons.  When you run the thinning tool it splits up the polygons that are overlapping, meaning it doesn't retain the integrity or structure.  Certainly works fine in principle, but when I tested it split the Test_Polys file that Stefan supplied into separate portions - seemingly using a reverse table order of object priority in terms of how it chooses to split up the overlaps.  If this is what Stefan is looking for then it works fine.
    Stefan, as Peter says, if this is not what you are looking for can you please share some more details.

    ------------------------------
    Tony Maber
    Pitney Bowes Software Pty Ltd (formerly Encom and MapInfo)
    North Sydney
    ------------------------------



  • 5.  RE: Thinning overlapping polygons

    Posted 05-15-2023 03:53

    Hi Tony,

    It's been a while...

    Wondering if a solution for the above was ever found...?

    To be specific, I too am looking to thin a whole bunch of overlapping polygons (catchments in my case) in a single layer...

    But the "snap/thin" tool seems to apply a "Clean" of sorts... I tried without ticking any of the 3 options and it still splits overlapping polygons.

    Simply looking to delete nodes that are within a certain distance of each other without any splitting of polygon (catchment) shapes...


    Original catchment




    Catchment after "Snap/Thin" tool applied


    Catchment after "Snap/Thin" tool applied but with no parameters set



    ------------------------------
    Sebastian Simoniuk
    Metcash Trading Limited
    Macquarie Park NSW
    ------------------------------



  • 6.  RE: Thinning overlapping polygons

    Posted 05-15-2023 13:00

    Hi Sebastian,

    I have a couple of methods you might like to try.  These are manual solutions but you could use the logic to develop a MapBasic program if needing to automate for large datasets or if you want to repeat the process on a number of datasets.  I am not sure if the first method will always succeed so came up with Method 2 as an alternative.

    METHOD 1
    1. Thin each object one at a time - either manually or via some mapbasic code such as:
    Dim nCounter As Integer
    Map From PolyTable
    Set Map Layer 1 Editable On
    nCounter = TableInfo(PolyTable, TAB_INFO_NROWS)
    For nCounter = 1 To nCounter
      Select * from PolyTable Where RowID=nCounter
      Objects Snap From Selection Thin Bend 0.2 Distance 2 Units "km"
    Next
    2. The problem with this is that the resultant objects will have been thinned independently, so coinciding borders will no longer match.  "Fit Objects" may solve this.  This is available from the Fix/Clean menu if you are running the MapCad tool.  Select all objects first, make sure the layer is editable, then use the "Fit Objects" tool.  For best results, I think the "Tolerance" should be set to the same value as the "Bend" (or "Deviation") value used in Step 1.
    METHOD 2
    1. Ensure your table "PolyTable" has a column that contains unique ids.
    2. Split each polygon one at a time using every other polygon.

    That is:
    For each polygon n
      select polygon n and set it as target
      select all other polygons (this can be done by selecting polygon n then inverting the selection)
      split
    Next
    This will eliminate partial overlaps.  Instead, duplicate polygons will be created where overlaps exist.
    3. Disaggregate (but retain holes) to ensure no multi-polygon regions exist.  (This step is probably unnecessary.)
    4. Create new field PolyArea (Char(15)) and update it with the polygon area:
    Update PolyTable Set PolyArea = Area(obj, "sq km")
    Note that duplicate polygons created by the overlaps will have the same area.
    5. Save a copy of your table as PolyTable_copy.
    6. Open PolyTable_copy in a mapper window, turn editable on for this table, select all objects within the table, and perform the snap/thin operation.
    This will thin the polygons nicely, but will also have the unfortunate effect of removing the duplicates.
    7. Using the resultant thinned objects, update your original table by joining on PolyArea:
    Select orig.*, copy.obj object
    From PolyTable As "orig", PolyTable_copy As "copy"
    Where orig.PolyArea = copy.PolyArea
    Into PolyTable_join
    8. Save the results (the "PolyTable_join" query) as new table "PolyTable_updated" and open.
    This table will contain the thinned polygons, with duplicates intact.
    9. Perform a "Combine Using Column" on PolyTable_updated.  When performing this operation:
      - Group objects by the unique ID column
      - Store results in a new table (PolyTable_final).
      - Within the Data Aggregation window, make sure you specify the "Value" option for each field and match up source and destination fields so you don't lose values that were in your original table.



    ------------------------------
    James Nolet
    Dooley Mitchell & Morrison Pty Ltd
    Mentone, VIC, Australia
    ------------------------------