MapInfo Pro

 View Only
  • 1.  Convert Polygons to Polylines - Automation Question

    Posted 01-06-2022 09:16
    Hello everyone,

     MapInfo Pro -> Spatial Tab -> Convert Polygons to Polylines

    This button allows you to make a layer (with polygons) editable and convert those polygons into polylines.  This is useful for me when I have municipal boundaries and I wanted to make a geoJSON file to display as an overlay on a Google Map.

    My question is, does anyone know what code/process is run/called by MapInfo Pro in order to do the actual conversion?  

    I would like to be able to call a mapbasic program that mimics this functionality on demand. 

    Is this possible?

    Thanks in advance for any help.

    ------------------------------
    Nicholas Evanish
    ------------------------------


  • 2.  RE: Convert Polygons to Polylines - Automation Question

    Posted 01-07-2022 09:25

    All,

    I spent all day yesterday continuing to investigate.  I did not find anything within MapInfo Pro; however, I have found a solution within SQL Server (only). So, if you were hoping for a MapBasic solution, I do not have that one yet.  I am able to do the following with SQL Server:

    1. Upload my dataset(s) in SQL Server (uploaded through EasyLoader software)
    2. Run SELECT statements on the GEOMETRY field
    3. Use STBoundary() function

    If I have any luck with Map Basic I'll be sure to update this thread.



    ------------------------------
    Nicholas Evanish
    ------------------------------



  • 3.  RE: Convert Polygons to Polylines - Automation Question

    Posted 01-07-2022 09:33

    Hello Nicholas,

     

    The MapBasic equivalent to the "Convert Polygons to Polylines" option is ConvertToPline(), which can accept a region object as the sole parameter and returns the polyline version. You can update a whole table programmatically with:

     

    update yourTable set obj = converttopline(obj)

     

    If you're table is quite large, it may be worth issuing the following statement first, which will disable undo and make direct writes to the table.

     

    set table yourTable fastedit on undo off

     

    Hope that helps.

     

    Regards,

    Warren Vick