Data Compression Algorithm for Trajectories