We introduce a compressed data structure for the storage of free trajectories of moving objects (such as ships and planes) that efficiently supports various spatio-temporal queries. Our structure, dubbed GraCT, stores the absolute positions of all the objects at regular time intervals (snapshots) using a k 2 -tree, which is a space-and time-efficient version of a region quadtree. Positions between snapshots are represented as logs of relative movements and compressed using Re-Pair, a grammar-based compressor. The nonterminals of this grammar are enhanced with MBR information to enable fast queries.The GraCT structure of a dataset occupies less than the raw data compressed with a powerful traditional compressor such as p7zip. Further, instead of requiring full decompression to access the data like a traditional compressor, GraCT supports direct access to object trajectories or to their position at specific time instants, as well as spatial range and nearest-neighbor queries on time instants and/or time intervals.Compared to traditional methods for storing and indexing spatio-temporal data, GraCT requires two orders of magnitude less space, and is competitive in query times. In particular, thanks to its compressed representation, the GraCT structure may reside in main memory in situations where any classical uncompressed index must resort to disk, thereby being one or two orders of magnitude faster.Indexes that handle free trajectories of points in the space are also called spatiotemporal indexes. One type spatio-temporal index builds on a classic multidimensional spatial index, in the form of a temporally augmented R-tree [13]. While the R-tree uses two-dimensional Minimum Bounding Rectangles (MBRs) to enclose the spatial objects stored in the database, the 3DR-tree [42] uses Minimum Bounding Boxes (MBBs), where the third dimension is time, to enclose the segments of the trajectories. The problem is that the three-dimensional space covered by an MBB can be large, even in small segments, resulting in high levels of overlap and limited power of discrimination. The STR-Tree [32] is an extension of the 3DR-tree designed to overcome this problem, by modifying the insertion/split strategy that produces the MBBs. The same work also proposes an index called TB-tree, where several segments of a trajectory are bundled into partial trajectories that are inserted as MBBs of an R-tree.A second kind of index is a versioned R-tree, which creates an R-tree for each timestamp and a B-tree to select the relevant R-trees. Creating an R-tree for each timestamp requires large amounts of space. To overcome this, instead of storing the complete R-tree for each timestamp, these techniques store only the part of the R-tree that is different from the R-tree in the previous timestamp. Examples of indexes of this type are MR-tree [46], HR-tree [27], HR+-tree [39] and MV3R-tree [40]. A third family of indexes, called grid-based indexes, partition the space and build a temporal index for each of the spatial partitions. The Scalable and Efficie...