A method for compressing a digital terrain modelling (DTM) file to produce a compressed file suitable for being stored and decompressed in real time by an on-board computer, the DTM file including a tile comprising a matrix of cells, each cell of which includes an elevation value of a geographical point of a modelled terrain, the method comprising:
- representing the tile in the form of an initial tree including a root node, a plurality of intermediate nodes and a plurality of terminal nodes, the initial tree having a plurality of depth levels, each node of the initial tree representing a zone of the source tile, each terminal node of the initial tree representing a zone of the tile corresponding to one cell of the matrix of cells;
- pruning the initial tree by applying a pruning criterion to obtain a pruned tree, the pruning criterion allowing, when verified, to locally limit a number of depth levels of the initial tree by stopping at an intermediate node, the intermediate node then being considered as a terminal node of the pruned tree, and representing a zone of a simplified tile having a unique elevation value which is a function of the elevation values of the cells associated with the terminal nodes which descend from the intermediate node and which have been pruned;
- encoding the elevation value associated with each of the terminal nodes of the pruned tree to obtain a differential elevation value, the differential elevation value of a terminal node of the pruned tree being obtained by the difference between the elevation value associated with the terminal node and the elevation value associated with a previous terminal node of the pruned tree, defined in accordance with ordering rules allowing to order the terminal nodes of the pruned tree one after the other starting from a reference terminal node, the elevation value of which is taken as the reference elevation and differential elevation value of which is equal to zero;
- and
- serializing the pruned tree resulting from the encoding to obtain the compressed file by traversing the terminal nodes of the pruned tree according to a serialization order starting from the reference terminal node, the compressed file including a first field indicating the reference elevation, then a plurality of sequences, each sequence comprising a header, indicative of a depth level of the terminal node under consideration, and a load, indicative of the differential elevation value of the terminal node under consideration.