Calculating the total length of multiple line segments in MapInfo Pro

Product affected: MapInfo Pro™
MapInfo Pro users frequently need to calculate the total length of multiple line objects.

This calculation can easily be achieved using SQL select (in 64-bit Pro go to Spatial > Selection > SQL Select).
Select the line segments by clicking on one of the objects, holding the shift key down, and selecting the remaining objects to be queried.

Alternatively, a query may be possible (based on data present) to select the desired objects, based on object-specific data in the table such as ID, etc.

Once the desired objects are selected, go to launch the Sql Select dialog and execute this query:
“sum(ObjectLen(obj, "km")) "Length_Sum"”

This will return the value in Kilometers.  For Miles, substitute "km" with "mi" or other desired units of measure.

Another approach:

With the objects to be measured selected, open the ​"SQL Select" dialog box and use these parameters -
  • from Tables: Selection
  • Select Columns: SphericalObjectLen(obj, "mi")
User-added image

Click OK to run the Query and the result will be a new query table with one field & a row for each object showing the object length
(in miles,but the desired units can be changed).
Open the Statistics window and the sum of all fields in a single total will be displayed.
One can use the "Sum" aggregation to get the sum of the object length in the query.
The Selected Columns field will look like this: Sum(SphericalObjectLen(obj, "mi"))

Note that the ObjectLen() function comes in a few variations. If the data is projected, that is not using a "Lat/Long" coordinate system, we recommend that the CartesianObjectLen() function be used.
UPDATED:  December 2, 2019