Converting a table of coordinates to a table of lines from the MapBasic window in MapInfo Professional

Product Affected: MapInfo Pro
The following command can be used to convert a table of coordinates to a table of lines. The table must contain the coordinates for the beginning and the end of the line. It is very important to make any changes on a copy of the table; it may be necessary to use the original data at a later time.

To execute the command to convert the points to lines or create lines for the table, open the MapBasic Window through (Options>Show MapBasic Window), type in the following command and press enter:

update point_table set obj=createline(Start_X, Start_Y,End_X,End_Y)

In the statement, substitute the name of the table for point_table.
Start_X, Start_Y, End_X and End_Y represent the columns in point_table that have the starting and ending coordinates for each line.

Important Notes:
Before proceeding with the update, make sure that the table in which the lines will be stored is mappable. To make the table mappable, make sure the table's "Table Is Mappable" box is checked. (Table>Maintenance>Modify Structure: Table Is Mappable.)

If a layout window was opened in this session of MapInfo, re-start MapInfo and then execute the command before opening another layout window.

If the table being used is projected, the line objects may not be created properly. To work around this situation, open up a new map window of a table in a different projection than the one the table being used in this operation is in. Choose Map>Options and click on the projection button. Choose the projection of the table the create lines operation is being used on. Click OK. Then, execute the MapBasic command and the lines should be created correctly.

UPDATED:  December 3, 2019