In the mapping section add a method to return the distance based on a line strings. It should be something like Myline.distance and it will return a decimal number in KM or Miles or Meters according to the points in the line string/set of coordinates

Interesting. The total distance represented by a LineString can easily be calculated with Blocks.

using Lists and a Distance algorithm to determine the distance between the coordinates of individual pieces of the LineString. Here is a partial solution showing the potentially difficult part of calculating the distance using one of several possible techniques that can determine the total distance and individual parts:

Best wishes,

Steve