Let's say that I receive lists of coordinates (latitude,longitude), each representing a 2D route. Later I want to use this data for route prediction, but first I have a preliminary problem to solve: I was expecting these lists to be sorted and, although the majority of the coordinates of each route are indeed sorted, some are not. For example:

a) expected:

enter image description here

b) actual:

enter image description here

where t is a timestamp.

I am looking for solutions to address this problem, for example remove all coordinates like b.t3 or sort the lists appropriately. Does anyone have any suggestion?

  • $\begingroup$ You could split the actual routes you get when they represent several routes? $\endgroup$ Dec 20, 2018 at 14:57
  • $\begingroup$ I don't think I understood your question, each list of coordinates represents only one route. Did I answer your question? $\endgroup$ Dec 20, 2018 at 15:00
  • $\begingroup$ Actual shows two possible paths to go from t1 to t4: t1->t2->t4 or t1->t2->t3->t4 $\endgroup$ Dec 20, 2018 at 15:09
  • $\begingroup$ Sorry for the confusion. There is only one path t1->t2->t3->t4, these are 4 pairs of coordinates of a participant, in which she traveled in a straight line. Unfortunately, the order and/or timestamps are not always correct. $\endgroup$ Dec 20, 2018 at 15:13

1 Answer 1


This raises many questions that you may or may not be able to answer, and this may not be helpful but hopefully it is.

Regarding the data, what are it's origins? Is it all electronically collected or is it an amalgamation of, say delivery driver logs that could be easily falsified or recorded incorrectly? Asked another way, how do you know that the order, based on timestamps, is not correct?

On the other hand, if you know the relationship between the points on the route, why bother with the timestamp values? From your comments, it seems as though the participant traveled in a straight line. If that is the case, you know the order based on the coordinates. You could order them by distance from the mean of the coordinates.

Since there is some disagreement between the "known" route and the "recorded" route I think to resolve the data you need to understand what causes this disagreement? Is the timestamp produced by one device or multiple? If one device, maybe someone is not driving the advertised route. If multiple devices, maybe one is set to the wrong timezone or just has the wrong time.

Again, not really an answer, but hopefully helpful.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.