# Finding the length of a line constructed by coordinates

I have a list of coordinates, for example:

alist = {{6.51573, 6.93037}, {6.51573, 6.91062}, {6.51573, 6.91062}, {6.51573,
6.91062}, {6.51573, 6.91062}, {6.47624, 6.91062}, {6.47624,
6.87114}, {6.47624, 6.89088}, {6.47624, 6.87114}, {6.47624,
6.85139}, {6.47624, 6.85139}, {6.4565, 6.85139}, {6.4565,
6.85139}, {6.43675, 6.85139}, {6.43675, 6.85139}, {6.4565,
6.85139}, {6.4565, 6.87114}, {6.4565, 6.87114}, {6.4565,
6.87114}, {6.4565, 6.87114}, {6.47624, 6.87114}, {6.47624,
6.89088}, {6.49599, 6.89088}, {6.49599, 6.89088}, {6.49599,
6.89088}, {6.49599, 6.89088}, {6.51573, 6.91062}, {6.51573,
6.91062}, {6.51573, 6.89088}, {6.51573, 6.91062}, {6.49599,
6.91062}, {6.49599, 6.87114}, {6.47624, 6.85139}, {6.43675,
6.83165}, {6.41701, 6.8119}, {6.39726, 6.8119}, {6.37752,
6.8119}, {6.35777, 6.83165}, {6.33803, 6.85139}, {6.2788,
6.85139}, {6.23931, 6.8119}, {6.18007, 6.73292}, {6.10109,
6.67369}, {6.06161, 6.6342}, {6.02212, 6.6342}, {5.8839,
6.61446}, {5.80492, 6.59471}, {5.76544, 6.55522}, {5.68646,
6.51573}, {5.60748, 6.43675}, {5.5285, 6.39726}, {5.46927,
6.33803}, {5.41003, 6.29854}, {5.33105, 6.29854}, {5.25207,
6.21956}, {5.19284, 6.18007}, {5.13361, 6.16033}, {5.09412,
6.08135}, {5.03488, 5.98263}, {4.95591, 5.8839}, {4.89667,
5.84441}, {4.85718, 5.82467}, {4.83744, 5.74569}, {4.81769,
5.68646}, {4.7782, 5.60748}, {4.71897, 5.56799}, {4.65974,
5.54824}, {4.63999, 5.50876}, {4.62025, 5.46927}, {4.58076,
5.44952}, {4.52152, 5.39029}, {4.44254, 5.29156}, {4.4228,
5.1731}, {4.32408, 5.07437}, {4.22535, 4.99539}, {4.14638,
4.89667}, {4.12663, 4.87693}, {4.10689, 4.73871}, {4.0674,
4.63999}, {4.00816, 4.52152}, {3.92918, 4.40306}, {3.85021,
4.26484}, {3.83046, 4.16612}, {3.79097, 4.02791}, {3.73174,
3.90944}, {3.71199, 3.83046}, {3.63301, 3.71199}, {3.57378,
3.57378}, {3.55404, 3.4948}, {3.53429, 3.35659}, {3.45531,
3.25787}, {3.39608, 3.11965}, {3.33684, 3.08016}, {3.23812,
3.02093}, {3.23812, 2.98144}, {3.25787, 2.92221}, {3.23812,
2.86297}, {3.1394, 2.80374}, {3.08016, 2.72476}, {3.06042, 2.66553}}


I can see the line using the code

ListLinePlot[alist]


and I ask how to find the line length obtained from them.

• In alist there are duplicate points! Is this expected? Commented Jun 7, 2022 at 8:27
• Yes, these are real coordinates obtained by time, the same coordinate it means that the object does not move or return to the exact same place. Anyway, thanks for your answer
– erez
Commented Jun 7, 2022 at 15:13
• If two points are the same for different time, object has moved to the same place I think Commented Jun 7, 2022 at 15:33
• Yes you are right, if between two identical points there are few different points it means that the object moved and returned to the same place (The time differences are 20 msec)
– erez
Commented Jun 7, 2022 at 15:39

RegionMeasure[Line[alist]]
(*6.20188*)

lcoords = Partition[alist, 2, 1];
Total@(EuclideanDistance @@@ lcoords)


6.32033

EDIT

The alist starts of at {6.51573, 6.93037} and descends to its final location. The first few points look like this:

ListLinePlot[{alist[[1 ;; 40]]}]


and I think RegionMeasure is smart enough to discount these knots and double counted regions.

• +1 Compare Total@(EuclideanDistance @@@ Partition[#, 2, 1]) & /@ {alist, alist // Sort} with RegionMeasure[Line[#]] & /@ {alist, alist // Sort} Commented Jun 7, 2022 at 23:02