Efficient compression and indexing of trajectories