Skip to main content
. Author manuscript; available in PMC: 2016 Jul 1.
Published in final edited form as: Int J Geogr Inf Sci. 2015 Sep 29;30(5):929–947. doi: 10.1080/13658816.2015.1091462

Algorithm 1: Spot extraction

Input: A trajectory T, δG, δD
Output: A spot sequence S

1:   i = 0, S = <>;
2: while i < length (T) do
3:    j = i + 1, skipped = 0; lastIndex = i;
4:    sp = 〈pi〉; // start a new spot
5:    while j < length (T) do
6:     if skippedδG then // end of the current spot
7:      setStartEndTime(sp);
8:      S.Append(sp);
9:      break;
10:    else if dist(p; sp.c) ≤ δD then
11:     sp.Append(pj);
12:     lastIndex = lastIndex + 1; // reset the number of point skipped continuously
13:    else // the current point is consider as the noise
14:     skipped = skipped + 1;
15:    end if
16:     j = j + 1;
17:   end while
18:   i = lastIndex + 1;
19: end while
20: return S