Converting Polylines to Lines

Skip to first unread message

Reg Halstead

Jan 4, 2023, 5:42:26 AMJan 4
to MapInfo-L
Hello again guys,

I'm guessing this should be a quick one to answer:

I'm trying to convert some polylines to lines by using the "run menu command" function to trigger the "Convert to Lines" tool. Is that possible, please?

I opened up MENU.DEF in Notepad and it seems that these are the only commands relating to objects:
Define M_OBJECTS_SET_TARGET                    1610
Define M_OBJECTS_CLEAR_TARGET                  1611
Define M_OBJECTS_COMBINE                       1605
Define M_OBJECTS_DISAGG                        1621
Define M_OBJECTS_BUFFER                        1606
Define M_OBJECTS_CONVEX_HULL                   1616
Define M_OBJECTS_ENCLOSE                       1617
Define M_OBJECTS_VORONOI                       1622
Define M_OBJECTS_DRIVE_REGION                  1627
Define M_OBJECTS_SPLIT                         1612
Define M_OBJECTS_ERASE                         1613
Define M_OBJECTS_ERASE_OUT                     1614
Define M_OBJECTS_POLYLINE_SPLIT                1623
Define M_OBJECTS_OVERLAY                       1615
Define M_OBJECTS_CHECK_REGIONS                 1618
Define M_OBJECTS_CLEAN                         1619
Define M_OBJECTS_SNAP                          1620
Define M_OBJECTS_OFFSET                        1624
Define M_OBJECTS_ROTATE                        1625
Define M_OBJECTS_SMOOTH                        1602
Define M_OBJECTS_UNSMOOTH                      1603
Define M_OBJECTS_CVT_PGON                      1607
Define M_OBJECTS_CVT_PLINE                     1604

So I'm assuming there isn't a way to trigger the "Convert to Lines" tool with MapBasic, but I thought I'd better ask to be on the safe side.

I've got a backup plan, but it's not ideal. A while ago, I wrote a loop that converts polylines to lines piece by piece, but sadly, it takes a long time to run.

Many thanks in advance,

Peter Horsbøll Møller

Jan 4, 2023, 5:50:29 AMJan 4

Hi Reggie


It’s one of these two:

Define M_OBJECTS_CVT_PGON                      1607
Define M_OBJECTS_CVT_PLINE                     1604


I think it’s the last one


You can also use a simple Update statement:


Update SomeTable Set OBJ = ConvertToPline(OBJ)





Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer


From: <> On Behalf Of Reg Halstead
Sent: Wednesday, 4 January 2023 11.42
To: MapInfo-L <>
Subject: [MI-L] Converting Polylines to Lines


This message originated Externally. Use proper judgement and caution with attachments, links, or responses.

You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to
To unsubscribe from this group, go to:
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at

You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Uffe Kousgaard

Jan 4, 2023, 5:56:08 AMJan 4

I only see a "Convert to Polylines" tool in MapInfo and 1604 seems to be the corresponding menu item.

Anyway,my ToolBox ( has such a function.
It can convert in both directions, but in the end it is also a loop. Source code is included in link above.

Kind regards
Uffe Kousgaard

Reg Halstead

Jan 4, 2023, 6:04:29 AMJan 4
Thanks a lot for the speedy reply but it's the Convert to Lines tool I'm trying to trigger, not the "Convert to Polylines" tool (equivalent to ConvertToPlines() as you say).

MapBasic includes a ConvertToPlines() function and a ConvertToRegions() function, but sadly there isn't a ConvertToLines() function as well. I'm guessing that's something to do with the fact that converting polylines to lines changes the number of objects.

I'm trying to split polylines into separate lines and the Convert to Lines tool does it very quickly, as opposed to the loop I've written. Is it possible to trigger any button/tool in MapInfo or only the ones that are listed in MENU.DEF?

Best wishes,

Reg Halstead
GIS Project & Implementation Manager
RAH Services
Tel: 07790056983

Reg Halstead

Jan 4, 2023, 6:06:48 AMJan 4
Thanks a lot for the fast reply as well Uffe.

I'm just about to open it now.

Many thanks,

Uffe Kousgaard

Jan 4, 2023, 6:32:45 AMJan 4
Hi Reggie,

I see it is a function in mapCAD you are after.
It does something differently than my ToolBox.

I assume mapCAD also uses mapbasic, so maybe it is just your loop which needs to be optimized?
Remember to set fastedit on and such. Makes a big difference.


Reg Halstead

Jan 4, 2023, 6:35:29 AMJan 4
Thanks a lot, Uffe. I’ll give it a try. And thanks a lot for those files too. That was very generous. Reading through them will help built my MapBasic skills.

Reg Halstead

Jan 5, 2023, 4:57:31 AMJan 5
to MapInfo-L

Your recommendation to use a  mapCAD function yesterday worked just as I needed so I just wanted to say thanks.

The SplitToLines function worked perfectly.

Here's the syntax I used for anyone reading this thread at a later date. Note my table only contained polylines, otherwise more lines 
Select * from MYTABLE 
print Exec("MapCAD.MBX","SplitToLines") & " polylines have been converted into " & str$(tableinfo("MYTABLE",8)) & " lines."

Best wishes,
Reply all
Reply to author
0 new messages