Hi, python Supermen, I got a pseudo code as described below. I am trying to make it works, but running is really slow. Please help to facilitate it if you dont mind. The input table is as shown in attachment.
C = 0 (set of rep. points = empty)
for sj in S: (All GPS points involved in all trajectories)
find points are within (4m) to sj & are not represented by any rep. in C
calculate the centroid c*1 of these points
if no points are within (4m) to sj, then sj will represent itself (or marked as outlier/noise to be removed later)
find points (k) are within (2m) to c*1
for sk in k
if sk is not represented
assign sk to c*1
if sk is represented by c*2
compare distances dk1 & dk2
if dk1 < dk2
assign sk to c*1
If all neighbors of sk are represented, then randomly choose sj from the remaining un-represented points
Iterate until all sj are represented
C stores all rep. point (structure: C:[Id, Pc_X, Pc_Y, dir, ncp:{all pts within 2m (less or equal to) of c*i}] s) *