0

I'm trying to obtain an average path given a group of similar paths of different lengths. Path data is only spatial, with no time attributed to each point.

To put it simply, is there an algorithm that can find the red path given the blue paths?

Blue Paths

enter image description here

Red Path

enter image description here

il_raffa
  • 5,090
  • 129
  • 31
  • 36
zlchen
  • 1
  • 1
  • Perhaps this has some useful pointers http://stackoverflow.com/questions/4298206/how-to-average-two-or-more-geography-linestrings-using-c-sql-server-2008-spat – Liesel Apr 01 '16 at 02:43

1 Answers1

2

There is a solution to this problem in: "Comparing and combining time series trajectories using Dynamic Time Warping" from Neil Vaughan & Bogdan Gabrys.

It uses a Dynamic Time Warping (DTW) algorithm which tells how the points on trajectory A can be mapped to the points on trajectory B with the least "warping". You then compute an average of trajectory A+B by averaging the points in A and B that DTW has "paired". If you have more than two trajectories, proceed iteratively: first, merge A with B, then merge C with the result, and so on.

There's a good implementation of DTW in R (library dtw)

Ant
  • 790
  • 7
  • 18
  • 2
    Bit of necromancy there, but to avoid people reading this thread making the mistake, mean([A,B,C])!=mean([mean([A,B]),C]), so this technique doesn't work for more than one trajectory. If you have an even number of trajectories, what you could do is make pairs minimizing the distance between each members of it, then average those pairs, pair the averages, and so on. This wouldn't create a perfect average, but you'd get closer to it than the solution Ant proposed. – Spoutnovitch Mar 25 '19 at 11:54
  • @Spoutnovitch You probably meant "the number of trajectories is a power of 2" rather than "an even number", because you'll be halving the amount of curves with each recursion. See also figure 7 in the referenced paper. – Mew May 17 '22 at 14:57