A Multi-Dimensional Adaptive Trajectory Compression Method for Road Networks
By employing a multi-dimensional adaptive trajectory compression method, lossless compression of timestamps, road segments, and distances along the road is achieved, resolving the issue of unstable trajectory data compression quality in existing methods and realizing efficient data storage and transmission.
Patent Information
- Application Number
- CN202611379100.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-07
- Publication Date
- 2026-11-10
AI Technical Summary
Existing trajectory compression methods employ lossy interpolation preprocessing in timestamp compression, resulting in the inability to recover the original timestamp. Road segment coding does not fully utilize the road network topology adjacency and historical transfer patterns. Distance compression does not incorporate the laws of motion physics, leading to unstable compression quality and low efficiency.
A multi-dimensional adaptive trajectory compression method is adopted, which performs multi-mode adaptive encoding on the timestamp sequence, adaptive compression on the road segment identification sequence based on road network topology prediction, and adaptive compression on the distance sequence along the road based on speed prediction. Combining the road network adjacency relationship and historical transfer pattern, and utilizing motion physical information, lossless compression is achieved.
It achieves a balance between high compression ratio and high fidelity, with a timestamp compression ratio of 99.52%, a road segment compression ratio of 96.21%, a distance compression ratio of 95.98%, and an overall compression ratio of 97.13% on the GeoLife dataset, which is significantly better than existing methods.
Smart Images

Figure CN123074508A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of trajectory data processing and compression technology, specifically to a multi-dimensional adaptive trajectory compression method for road networks. This method jointly compresses the road segment identifier sequence, road distance sequence, and timestamp sequence after road network matching. It can be applied to the efficient storage and transmission of trajectory data of moving objects such as vehicle GPS trajectories and taxi trajectories, and has promising application prospects in trajectory database compression, traffic flow analysis, and route planning. Background Technology
[0002] With the widespread use of GPS devices and mobile vehicle terminals, large-scale vehicle trajectory data is continuously collected. Trajectory data records the continuous changes of moving objects in time and space, recording vehicle travel paths and road usage patterns. However, the scale of trajectory data is growing rapidly, posing a severe challenge to data storage and transmission. Trajectory compression technology has become a key means to solve this problem.
[0003] Existing trajectory compression methods are mainly divided into two categories: free space-oriented methods and road network-constrained methods.
[0004] Free-space-oriented methods (such as the Douglas-Peucker algorithm and the TD-TR algorithm) directly compress the original GPS points, removing redundant points by setting distance or angle thresholds. These methods are computationally simple and efficient, but they ignore the road network constraints of the trajectory. The compressed trajectory points may deviate from the actual roads, making them difficult to use directly for subsequent road network-related analyses.
[0005] Road network constraint-oriented methods first match GPS trajectories to the road network to obtain road segment identification sequences, and then compress these sequences. Representative methods include the Direction-Oriented Representation (DOR) algorithm based on direction encoding and the Clockwise algorithm based on clock direction. The DOR algorithm achieves compression by encoding the turning direction of the trajectory between road segments, and has achieved good results in road network trajectory compression. However, existing road network constraint compression methods have the following shortcomings:
[0006] (1) Timestamp compression uses lossy interpolation preprocessing, which destroys the originality of the data. Existing methods first convert irregular sampling trajectories into fixed sampling intervals through interpolation, and then only save the start time and sampling interval. Although this method can compress regular time series, it can only recover the interpolated timestamps and cannot recover the original irregular timestamps. In essence, it is a lossy process that destroys the originality of the trajectory data. The sampling intervals of actual GPS trajectories (such as the T-Drive dataset) often have a large range of variation, and the fixed interval assumption does not hold, resulting in unstable compression quality.
[0007] (2) Road segment coding does not make full use of topological context and historical transfer patterns. The DOR method mainly uses the directional relationship between the current road segment and the previous one or two road segments for coding. In essence, it is still mainly based on local directional coding, which has the following shortcomings: 1. It does not consider the opportunity of continuous repeating of road segments to compress the run; 2. It does not make full use of the road network topological adjacency relationship to narrow down the candidate set; 3. It does not use the transfer statistics of historical trajectories to improve the prediction accuracy.
[0008] (3) Distance compression does not incorporate the physical laws of motion. The distance sequence along the road is directly fed into Elf compression as ordinary floating-point numbers. Elf is a general-purpose floating-point lossless compression algorithm that mainly utilizes the redundancy of the mantissa in the binary representation of floating-point numbers. It has no knowledge of which road the vehicle is on, how long the road is, the time interval between the preceding and following points, or the current speed of the vehicle. Therefore, Elf does not utilize the physical motion laws of trajectory data, and there is room for further improvement in compression efficiency. Summary of the Invention
[0009] The purpose of this invention is to overcome the shortcomings of the prior art and provide a multi-dimensional adaptive lossless compression method for road network trajectories. It aims to solve the problems in the prior art, such as the inability to recover the original timestamp due to interpolation preprocessing in timestamp compression, the failure to utilize the road network topology adjacency and historical transfer rules when road segment encoding is based only on local directional relationships, and the failure to combine motion physical information when distance compression treats the distance along the road as a regular floating-point number. By coordinating adaptive compression of the three dimensions of time, road segment, and distance, a balance between high compression ratio and high fidelity is achieved.
[0010] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0011] A multi-dimensional adaptive trajectory compression method for road networks, characterized in that the method specifically includes the following steps:
[0012] S1. Preprocess the raw trajectory data, including data reading and parsing, spatial range filtering, trajectory integrity check, road network data loading, complete road network matching, output trajectory data, and decompose it into road segment identifier sequence, road distance sequence and timestamp sequence;
[0013] S2. Perform multi-mode adaptive time compression on the timestamp sequence: Calculate the difference between adjacent timestamps, and for time intervals of different types, use run-length encoding, second-order Delta-of-Delta encoding, and differential raw increment Rice encoding to adaptively select the mode with the lowest compression cost in the trajectory data block for encoding.
[0014] S3. Adaptive spatial compression of road segment identifier sequences based on road network topology prediction: First, obtain a set of candidate road segments based on road network adjacency relationships. Then, prioritize the candidate road segments by combining historical transition probabilities and directional continuity. Encode the ranking of the actual next road segment in the candidate set and perform run-length encoding on consecutive repeating road segments. At the same time, store the directional encoding DOR and the original road segment ID as alternative strategies. Select the strategy with the lowest compression cost from the trajectory data for encoding.
[0015] S4. Adaptive distance compression based on speed prediction is performed on the distance field along the road: the displacement along the road between adjacent trajectory points is calculated, the current displacement is predicted using the displacement and time interval of the previous two trajectory points and the prediction residual is calculated, the prediction residual is adaptively quantized, and the quantized residual sequence is encoded with zero residual run-length encoding; compared with quantization-based Elf compression, the scheme with the lowest compression cost is selected for encoding.
[0016] S5. Merge the compression results of steps S2, S3, and S4, and output the compressed trajectory data; During the extraction process in step S1: the road segment identifier field is matched by HMM and Dimensional Bit algorithm to map the GPS trajectory points to the road network, the distance along the road field is the projection distance of each trajectory point on its road segment, the timestamp field is the collection time of each trajectory point, and the road segment identifier sequence is the road segment ID matched with the corresponding trajectory point.
[0017] Based on run-length encoding, multiple differential encodings are superimposed for adaptive selection: the fixed-interval run-length encoding in step S2 includes: detecting whether the adjacent time difference is constant, and if it is constant, only storing the initial time difference value and the number of trajectory points; Delta-of-Delta encoding includes: calculating the difference between adjacent time differences again, and performing ZigZag encoding and Rice encoding on the second-order difference; the original incremental Rice encoding includes: directly performing Rice encoding on the adjacent time difference value.
[0018] The adaptive spatial compression based on road network topology prediction is as follows: The method for obtaining the candidate road segment set in step S3 is as follows: Obtain the end node of the current road segment, and obtain all adjacent road segments of that end node from the road network as the candidate set. The size of the candidate set does not exceed a preset upper limit. The method for calculating the historical transfer probability is as follows: Statistically count the frequency of transfers from the current road segment to each candidate road segment in historical trajectory data, and divide the frequency by the total number of transfers of the current road segment to obtain the transfer probability; directional continuity is the cosine of the angle between the direction of the current road segment and the direction of the candidate road segment; the transfer probability and directional continuity are weighted and fused to obtain the priority score of the candidate road segment.
[0019] The adaptive spatial compression based on road network topology prediction is as follows: Step S3, encoding the ranking of the actual next road segment in the candidate set, includes: if the ranking is 0th, use 1 bit for encoding; if the ranking is 1st, use 2 bits for encoding; if the ranking is 2nd, use 3 bits for encoding; if the ranking is greater than 2, use 4 bits followed by the Rice-encoded ranking value; if the actual next road segment is not in the candidate set, directly store the original ID of the road segment. Directional encoding based on directional continuity is as follows: calculate the turning direction of the trajectory at three consecutive nodes, encode the turning direction as a Q-ary bit string, and the compression cost is the total number of bits after encoding.
[0020] The specific calculation process of adaptive distance compression based on speed prediction is as follows: The method for calculating the displacement along the road in step S4 is as follows: If two adjacent trajectory points are on the same road segment, the displacement is equal to the difference in the distances along the road between the two points; if two adjacent trajectory points are on different road segments, the displacement is equal to the sum of the remaining length of the previous road segment and the distance along the road segment of the current road segment. The specific method for speed prediction is as follows: Calculate the speed at the previous moment based on the displacement of the two previous trajectory points and the time interval, multiply the speed at the previous moment by the ratio of the current time interval to the time interval of the previous moment, and obtain the predicted value of the current displacement; the prediction residual is the actual displacement minus the predicted displacement. Zero residual run-length encoding includes: traversing the quantized residual sequence, counting the number of consecutive zero values, marking zero-value runs with 1 bit, and recording the run length using Rice encoding when the run length is greater than 1; after marking non-zero residual values with 1 bit, ZigZag encoding and then Rice encoding are performed. ELF compression involves: performing global normalized quantization on the distance sequence along the road, calculating the difference value on the quantized sequence, and performing lossless compression on the difference value based on the IEEE 754 floating-point standard.
[0021] The above three parts are integrated to complete the comprehensive compression: The merged output mentioned in S5 includes: splicing the compression results and selected mode markers of step S2, the compression results and selected strategy markers of step S3, and the compression results and selected scheme markers of step S4 in the trajectory order to form a complete compressed data stream.
[0022] The advantages of this invention are as follows: By designing three encoding modes for the timestamp sequence and adaptively selecting them, this invention solves the problem that existing methods rely on interpolation preprocessing, which leads to the inability to recover the original irregular timestamps. It achieves strict lossless compression of timestamps, with a time compression rate of 99.52%.
[0023] This invention utilizes run-length decomposition and topological context prediction coding to design road segment sequences, making full use of road network adjacency relationships and historical transfer patterns. It adaptively selects the optimal strategy from three approaches: RunTopology, DOR, and RawID, achieving a road segment compression rate of 96.21%.
[0024] This invention designs speed prediction residual coding for distance sequences along the road, utilizes physical information such as road length, time interval, and movement speed, and combines zero residual run-length coding with Elf hybrid optimization to achieve a distance compression rate of 95.98%, which is superior to the Elf scheme on 86.3% of the trajectories.
[0025] The three compression modules of this invention work together to achieve an average compression rate of 97.13% on the GeoLife real trajectory dataset, which is significantly better than the DOR algorithm (92.89%), Clockwise algorithm (91.94%) and ZSTD general compression algorithm (68.96%).
[0026] This invention does not employ any lossy preprocessing; all encodings are strictly lossless, and the original trajectory data can be completely recovered after decoding, ensuring the integrity and traceability of the data. Attached Figure Description
[0027] The following is a brief explanation of the contents of each of the accompanying drawings and the markings in the drawings:
[0028] Figure 1 This is a diagram of the overall model architecture of the present invention;
[0029] Figure 2 This is an example of adaptive spatial compression based on road network topology prediction according to the present invention;
[0030] Figure 3 Flowchart for timestamp multi-mode adaptive compression;
[0031] Figure 4 Flowchart for velocity prediction distance compression;
[0032] Figure 5 Compression ratio comparison chart. Detailed Implementation
[0033] The specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings and the description of the preferred embodiments.
[0034] This embodiment presents a multi-dimensional adaptive trajectory compression method for road networks, suitable for the efficient storage and transmission of vehicle GPS trajectory data after road network matching. The trajectory data after road network matching is decomposed into three dimensions: road segment identifier sequence, road distance sequence, and timestamp sequence. Targeted adaptive compression strategies are designed for each dimension: multi-mode run-length encoding is used for the time dimension, transition probability prediction encoding based on road network topology is used for the road segment dimension, and residual encoding and zero-run-length encoding based on speed prediction are used for the distance dimension. The compression results of the three dimensions are fused through a hybrid optimization mechanism to achieve a balance between high compression ratio and high fidelity. The effectiveness of this invention is verified on two datasets with different sampling characteristics. On the densely sampled GeoLife dataset, the method achieves a compression ratio of 97.13%, a 4.24% improvement over DOR; on the sparsely sampled T-Drive dataset, the method achieves a compression ratio of 97.07%, a 4.00% improvement over DOR. Overall, it significantly outperforms existing mainstream road network matching trajectory compression methods and is suitable for intelligent transportation, location services, and other scenarios.
[0035] This embodiment of a multi-dimensional adaptive lossless compression method for road network trajectories includes the following steps:
[0036] S1. Data Acquisition and Decomposition: Acquire trajectory data after road network matching. The trajectory data includes road segment identification sequence, road distance sequence and timestamp sequence.
[0037] Suppose a trajectory contains n trajectory points, the trajectory data can be represented as:
[0038]
[0039] in, This indicates the identifier of the road segment where the i-th trajectory point is located. This represents the projected distance of the i-th trajectory point along its corresponding road segment. This represents the timestamp of the i-th trajectory point.
[0040] Road segment identification sequence The GPS trajectory points are mapped to the road network using map matching algorithms, Hidden Markov Models, and the Dimensional Bit Algorithm. The distance sequence along the road is then obtained. middle, ,in Indicates road section Total length of the timestamp sequence. Sort by time in ascending order;
[0041] S2. Perform multi-mode adaptive compression on the timestamp sequence, selecting the mode with the lowest compression cost from three modes: fixed-interval run-length encoding, Delta-of-Delta encoding, and original incremental Rice encoding. The compression cost comparison method for the three modes is as follows: calculate the number of bits after compression for each mode according to formulas A, B, and C respectively. The mode with the smallest value is selected as the optimal compression scheme for the trajectory block, i.e. The selected pattern is marked with 2 bits.
[0042] Let the difference between adjacent timestamps be 1. , First, check all Are they equal? If they are equal, then only the initial timestamp needs to be stored. Fixed interval value and the number of trajectory points The number of bits after compression is:
[0043] Mode A: Fixed-interval run-length encoding
[0044] If they are not equal, then... Perform run-length encoding: Count the differences between consecutive equal pairs and their repetition counts, storing them as a sequence of (difference, repetition count) tuples. The compressed bit count is:
[0045]
[0046] in, For the number of tours, For the first The number of times a trip is repeated. This is the Rice encoding function.
[0047] Mode B: Delta-of-Delta encoding
[0048] For timestamp sequences with large fluctuations in differences, the differences between adjacent times are subtracted again to obtain the second-order difference. , The second-order difference is encoded using ZigZag and Rice codes, resulting in the following number of bits after compression:
[0049]
[0050] in, This is a ZigZag encoding function used to map signed integers to non-negative integers.
[0051] Mode C: Raw Incremental Rice Encoding
[0052] Directly comparing the time difference between adjacent times After Rice encoding and compression, the number of bits is:
[0053]
[0054] Select the mode with the smallest number of bits after compression from the three modes, mark the selected mode with two bits, and finally store it together with the compression result;
[0055] S3. Adaptive spatial compression based on road network topology: Adaptive compression based on road network topology is performed on the road segment identification sequence, and the optimal solution is selected by combining three encoding strategies.
[0056] S3.1 Strategy A: Predictive coding based on topological transition probabilities (RunTopology)
[0057] The core idea of this strategy is to use the adjacency structure of the road network and the transfer patterns of historical trajectories to predict the next road segment and efficiently encode the prediction results.
[0058] Step 1: Road segment travel coding
[0059] Road segment identification sequence Perform run-length encoding to merge consecutive identical road segments, resulting in... Binary sequence:
[0060]
[0061] in, For road section markings, This represents the number of times the road segment is repeated consecutively.
[0062] Step 2: Acquiring Candidate Road Segments
[0063] For the current road section Obtain its end node Obtain from the road network All adjacent road segments are used as the candidate set:
[0064]
[0065] in, It is the set of all road segments in the road network. For road section The starting node. The size of the candidate set is limited to no more than a preset upper limit. .
[0066] Step 3: Prioritize candidate road segments
[0067] By combining historical transition probabilities and turning angles, the priority score of each road segment in the candidate set is calculated.
[0068] Historical transition probability The calculation method is as follows:
[0069] (in, From historical trajectory data, from road segments Transfer to road section The number of times, To start from the current road section The total number of transfers to all its candidate road segments. This ratio represents the total number of transfers from... Transferred to The historical transition probability.
[0070] in, From road segment in the historical trajectory Transfer to road section The number of times.
[0071] Steering angle similarity The calculation method is as follows:
[0072]
[0073] in, The direction vector of the current road segment. Given the direction vectors of the candidate road segments, the dot product result is normalized to... Interval.
[0074] The overall priority score is:
[0075]
[0076] in, and These are weighting coefficients, dynamically adjusted based on the amount of historical data. Finally, the candidate road segments are sorted from highest to lowest priority score to obtain a ranked list. .
[0077] Step 4: Ranking Coding
[0078] For the actual next road segment ,exist Search for its ranking in Then, different number of bits are assigned to the code for different rankings.
[0079] Step 5: Repetition Count Encoding
[0080] run length Use Rice encoding.
[0081] Step Six: Compression Cost Calculation
[0082]
[0083] in, The number of bits required to encode the above ranking.
[0084] S3.2 Strategy B: Direction-based Direction Encoding (DOR)
[0085] Compression is achieved by encoding the turning direction of the trajectory. For consecutive nodes in the road segment sequence... Calculate the two steering directions and :
[0086]
[0087] in, The function calculates the angle between two directions formed by four nodes and outputs a value between 0 and 1. integers (where) (Quantification level for direction).
[0088] like and If they are the same, the code is 0; otherwise, the code is 1 followed by... The number of bits after compression is... .
[0089] S3.3 Strategy C: Raw ID Storage
[0090] Store the raw 64-bit ID of each road segment directly:
[0091]
[0092] S3.4 Strategy Selection
[0093] Compare the number of bits after compression using the three strategies, and select the strategy with the fewest bits as the spatial compression method for this trajectory segment. The selected strategy is then labeled with two bits. (in, Let be the number of compressed bits for strategy A (predictive coding based on topological transition probabilities). The number of bits after compression for strategy B (direction-based directional coding). This represents the number of bits after compression for strategy C (direct storage of the original ID). Indicates taking The strategy with the minimum cost is the optimal strategy.
[0094] S4. Adaptive distance compression based on velocity prediction: Adaptive compression based on velocity prediction is performed on the distance sequence along the road, and the result is compared with the Elf quantization scheme based on floating point numbers to determine the best option.
[0095] S4.1 Calculation of Displacement Along the Road
[0096] Calculate the displacement along the road between adjacent trajectory points :
[0097] like If it is on the same road segment, then:
[0098]
[0099] like In different road sections:
[0100]
[0101] in, For road section The total length.
[0102] S4.2 Velocity Prediction and Residual Calculation
[0103] Predict the current displacement using the displacement and time interval of the first two trajectory points:
[0104] The velocity at the previous moment was:
[0105]
[0106] Predicting current displacement using motion continuity:
[0107] ;(in, This represents the displacement along the path between the previous adjacent trajectory points. For the previous time interval, For the current time interval, The instantaneous velocity at the previous moment, (This represents the current displacement predicted based on motion continuity.)
[0108] The predicted residuals are:
[0109]
[0110] S4.3 Adaptive Quantization
[0111] Select the quantization scale based on the maximum absolute value of the residual. and Encoding parameters :
[0112] like The quantization scale is set to 1000, and the Rice parameter is... Take 1; if Quantization scale set to 100, Rice parameter Take 1; if Quantization scale set to 50, Rice parameter Take 2; if Quantization scale is set to 20, Rice parameter Take 2; if Quantization scale is set to 10, Rice parameter Take 3.
[0113] The final quantized residual is:
[0114] ;
[0115] S4.4 Zero Residual Run Coding
[0116] Zero-run encoding is performed on the quantized residual sequence to fully utilize the characteristic that the residuals after velocity prediction are concentrated near the zero value, and the trajectory dwell points are handled in a targeted manner.
[0117] Traversing the quantized residual sequence If the current value is zero, count the number of consecutive zeros. Use 1 bit to mark a zero run, if Then use Record the run length; if the current value is non-zero, mark the non-zero value with one bit. After ZigZag encoding, Rice encoding is performed.
[0118] The number of bits after compression is:
[0119]
[0120] in, This is a zero-run-length encoding function.
[0121] S4.5 ELF Compression Scheme
[0122] ELF compression performs global normalization quantization on the distance sequence along the path, followed by differential encoding:
[0123] (Where, diffi is the first-order difference value calculated after global normalization quantization of the distance sequence along the path; the constant terms 32 + 32 + 4 + 4 + 16 are the fixed bit overhead for storing the maximum value, minimum value, quantization scale, quantization offset and difference bit number, respectively; rice_bits(·) is the Rice coding function, and n is the number of trajectory points.)
[0124] S4.6 Solution Selection
[0125] Compare the number of bits after compression between the speed prediction scheme and the Elf scheme, and choose the scheme with fewer bits:
[0126] (in, The compressed bit count of the velocity prediction and zero residual run-length encoding scheme described in S4.2 to S4.4. The number of bits after compression is the Elf floating-point number compression scheme described in S4.5. Indicates taking The solution with the smallest value is selected as the optimal compression solution in the distance dimension. The selection result is marked with 1 bit: 0 represents the velocity prediction solution, and 1 represents the Elf solution.
[0127] S5. Compression Result Fusion and Output: The time compression result of step S2, the spatial compression result of step S3, and the distance compression result of step S4 are spliced together in trajectory order to form a complete compressed data stream.
[0128] The compressed data stream includes: header information: original trajectory point count, compression scheme markers for each dimension; temporal compressed data: selected mode markers and encoding results; spatial compressed data: selected strategy markers and encoding results; distance compressed data: selected scheme markers and encoding results. The output format is a binary data stream, which can be directly written to a file or transmitted.
[0129] like Figure 1 This is a diagram illustrating the overall method framework of the present invention. Figure 1 As shown, the original GPS trajectory data is first input into the road network matching and 3D decomposition module, and the GPS points are projected onto the road network by the HMM+Viterbi algorithm for map matching. Then, it is decomposed into three dimensions: road segment identifier sequence E, road distance sequence D, and timestamp sequence T. The three dimensions are respectively fed into the three parallel modules of time compression, road segment compression, and distance compression in the compression encoder for adaptive compression. Finally, the trajectory data with a high compression ratio is fused and output.
[0130] The time compression module includes three coding modes: fixed-interval run-length encoding, Delta-of-Delta encoding, and original incremental encoding; the road segment compression module includes three coding strategies: run-length decomposition, topological context prediction, and DOR direction encoding; the distance compression module includes road-side displacement calculation, velocity prediction residual encoding, and zero-residual run-length encoding, which are then combined with the Elf scheme for optimal selection. Finally, all three modules employ an adaptive selection mechanism to choose the one with the lowest encoding cost.
[0131] Specifically, the method of the present invention includes the following steps S1 to S5.
[0132] The specific steps for road network matching and three-dimensional decomposition in S1 are as follows:
[0133] Obtain the raw GPS trajectory data of the moving object, and arrange each GPS trajectory in chronological order to form a sequence of trajectory points. ,in It includes longitude, latitude, and timestamp information. Using an HMM (Hidden Markov Model) combined with the Viterbi algorithm, the trajectory point sequence is matched to the digital road network to obtain the road segment identification sequence. ,in Let be the ID of the road segment where the i-th trajectory point is located.
[0134] The matched trajectory data is decomposed into three dimensions: road segment identifier sequence. Distance sequence along the road and timestamp sequence Each element in the distance sequence along the route... This is the normalized projected distance of the GPS point on its matching road segment. If the GPS point Projected onto road section The distance from the position above to the starting point of this road segment is Road section
[0135] The total length is Then the normalized distance .
[0136] The specific steps for timestamp multi-mode adaptive compression in S2 are as follows:
[0137] Figure 2 This is a flowchart of the timestamp multi-mode adaptive compression process of the present invention. Figure 2 As shown, timestamp sequence After input, the time difference between adjacent times is first calculated. Then it enters three parallel branches:
[0138] Mode A (Fixed Interval Run-Length Encoding): Detects all If the differences are equal, store the fixed interval value and number of points; otherwise, perform run-length encoding on consecutive equal differences, storing them as a sequence of (difference, repetition count) tuples, and calculate the encoding cost. This mode is suitable for regular sampling trajectories with constant sampling intervals. Mode B (Delta-of-Delta encoding): Calculates the second-order difference. The second-order difference is then ZigZag encoded followed by Rice encoded, and the encoding cost is calculated. This mode is suitable for trajectories with approximately constant sampling intervals but slight fluctuations. Mode C: For each Rice coding is performed directly; this mode is suitable for trajectories with highly irregular sampling intervals. Finally, the minimum cost mode is selected. It uses two bits to mark the selected pattern, outputs the pattern mark and encoding result, and achieves strict lossless compression of timestamps.
[0139] The specific steps for adaptive compression of road segments in S3 are as follows:
[0140] Figure 3 This is a schematic diagram illustrating the adaptive spatial compression based on road network topology prediction according to the present invention. Figure 3 As shown in (a), after run-length encoding, the original road segment sequence merges consecutively repeating road segments into a (segment ID, repetition count) tuple. For example, the original road segment sequence... After run-length encoding, it is compressed into Original storage requires bit, run-length storage only requires This saves approximately 55% of the data.
[0141] like Figure 3 As shown in (b), in the local topology of the road network, the current road segment The candidate roads include (straight), (Turn left), (Turn right) and (U-turn). For each candidate road Calculate its directional continuity score and historical transition probability score Through formula The final priority score is obtained by weighting the scores, and then sorted from highest to lowest. Among these, the directional continuity score is... The cosine value of the angle between the current road segment direction vector and the candidate road segment direction vector is normalized to... Interval, historical transition probability score The weight is calculated by dividing the frequency of transitions from the current road segment to a candidate road segment by the total number of transitions. and It can be dynamically adjusted based on the amount of historical data.
[0142] like Figure 3 As shown in (c), different lengths of encoding are assigned according to the predicted ranking: the 0th ranked position is encoded with 1 bit and recorded as 0, the 1st ranked position is encoded with 2 bits and recorded as 10, the 2nd ranked position is encoded with 3 bits and recorded as 110, the kth ranked position (k>2) is encoded with 4+Rice(k) bits and recorded as 1110"+Rice(k), and if it is not in the candidate set, it is encoded with 68 bits and recorded as 1111+original ID.
[0143] Three encoding strategies are set: Strategy A (RunTopology) uses run-length decomposition and topological context prediction encoding as described above; Strategy B (DOR) uses direction encoding based on the turning direction; and Strategy C (RawID) directly stores the raw ID. The actual number of bits for each strategy is calculated for each trajectory block, and the strategy with the fewest bits is selected. Output strategy tags and encoding results.
[0144] The specific steps for distance-adaptive compression in S4 are as follows:
[0145] Figure 4 This is a flowchart of the velocity prediction distance compression process of the present invention. Figure 4 As shown, the distance sequence along the road First, calculate the displacement along the road. When on the same road segment When crossing road sections ,in This represents the total length of the road segment. This step converts the distance along the road into actual displacement, eliminating jumps across road segments. Then, speed prediction and residual calculation are performed: previous speed... Predicting current displacement using motion continuity Calculate the predicted residual Because the vehicle's movement is continuous, the residuals are concentrated around 0.
[0146] Then, the quantization scale is adaptively selected based on the maximum absolute value of the residual: when Time quantization scale is set to 1000, Rice parameter ;when The time quantization scale is set to 100. ;when The time quantization scale is set to 20. ;when The time quantization scale is set to 10. After quantization, zero-residual run-length encoding significantly reduces the number of encoded bits. Finally, the above speed prediction scheme and the Elf scheme are combined and optimized: the number of compressed bits for both the speed prediction scheme and the Elf scheme is calculated separately, and the scheme with fewer bits is selected. As a result of distance compression.
[0147] The specific steps for fusing and outputting the compressed results in S5 are as follows:
[0148] The time compression results from step S2, the road segment compression results from step S3, and the distance compression results from step S4 are concatenated in trajectory order to form a complete compressed data stream. Each trajectory block contains complete anchor points. The final output is a binary data stream, which can be directly written to a file or transmitted, enabling the storage and transmission of trajectory data with a high compression ratio.
[0149] Figure 5 This is a comparison chart of the compression rates of the present invention and the comparison algorithm on two datasets. For example... Figure 5 As shown, the horizontal axis represents different compression algorithms (DOR, Clockwise, ZSTD, and this method), and the vertical axis represents the compression rate (%). Each group contains two bars representing the GeoLife and T-Drive datasets, respectively.
[0150] Experimental results show that our proposed method achieves optimal compression performance on both datasets. On the GeoLife dataset, our method achieves an average compression ratio of 97.13%, significantly outperforming the DOR algorithm (92.89%), Clockwise algorithm (91.94%), and ZSTD general compression algorithm (68.96%). On the T-Drive dataset, our method also achieves a compression ratio of 97.07%, outperforming DOR (93.07%), Clockwise (92.79%), and ZSTD (56.38%).
[0151] The highly consistent experimental results on the two datasets (97.13% vs 97.07%) fully validate the effectiveness and good generalization ability of our method on trajectory data with different sampling characteristics. Compared with the DOR algorithm, our method improves performance by 4.24 and 4.00 percentage points on the GeoLife and T-Drive datasets, respectively, and by 5.19 and 4.28 percentage points compared with Clockwise, respectively.
[0152] Obviously, the specific implementation of this invention is not limited to the above-described manner. Any non-substantial improvements made using the inventive concept and technical solution of this invention are within the protection scope of this invention.
Claims
1. A multi-dimensional adaptive trajectory compression method for road networks, characterized in that... The steps include the following: S1. Preprocess the original trajectory data, decomposing the original trajectory into a road segment identifier sequence, a road distance sequence, and a timestamp sequence; S2. Compress the road segment identifier sequence, the distance along the road sequence, and the timestamp sequence respectively; S3. Combine the compression results from step S2 to obtain the compressed trajectory data.
2. The multi-dimensional adaptive trajectory compression method for road networks as described in claim 1, characterized in that... In step S1, preprocessing includes data reading and parsing, spatial range filtering, trajectory integrity checking, road network data loading, road network matching, and outputting trajectory data.
3. A multi-dimensional adaptive trajectory compression method for road networks as described in claim 1 or 2, characterized in that... In step S1, the road segment identifier field is matched by HMM and Dimensional Bit algorithm to map GPS trajectory points to the road network. The distance along the road field is the projection distance of each trajectory point on its road segment. The timestamp field is the collection time of each trajectory point. The road segment identifier sequence is the road segment ID matched with the corresponding trajectory point.
4. The multi-dimensional adaptive trajectory compression method for road networks as described in claim 1, characterized in that... In step S2, multi-mode adaptive time compression is performed on the timestamp sequence: the difference between adjacent timestamps is calculated, and for time intervals of different types, run-length encoding, second-order Delta-of-Delta encoding, and differential raw increment Rice encoding are used to adaptively select the mode with the lowest compression cost in the trajectory data block for encoding.
5. The multi-dimensional adaptive trajectory compression method for road networks as described in claim 4, characterized in that... The fixed-interval run-length encoding in step S2 includes: detecting whether the adjacent time difference is constant; if it is constant, only the initial time difference value and the number of trajectory points are stored; Delta-of-Delta encoding includes: subtracting the adjacent time difference again, performing ZigZag encoding on the second-order difference, and then Rice encoding; the original incremental Rice encoding includes: directly performing Rice encoding on the adjacent time difference.
6. The multi-dimensional adaptive trajectory compression method for road networks as described in claim 1, characterized in that... Step S3 includes adaptive spatial compression of the road segment identifier sequence based on road network topology prediction: First, a set of candidate road segments is obtained based on the road network adjacency relationship. The candidate road segments are prioritized by combining historical transition probability and directional continuity. The ranking of the actual next road segment in the candidate set is encoded, and run-length encoding is performed on consecutive repeated road segments. At the same time, the directional encoding DOR and the original road segment ID are stored as alternative strategies, and the strategy with the lowest compression cost is selected from the trajectory data for encoding.
7. A multi-dimensional adaptive trajectory compression method for road networks as described in claim 6, characterized in that... The method for obtaining the candidate road segment set in step S3 is as follows: obtain the end node of the current road segment, and obtain all adjacent road segments of the end node from the road network as the candidate set. The size of the candidate set shall not exceed the preset upper limit. The method for calculating the historical transfer probability is as follows: count the frequency of transfer from the current road segment to each candidate road segment in the historical trajectory data, and divide the frequency by the total number of transfers of the current road segment to obtain the transfer probability. Directional continuity is the cosine of the angle between the current road segment direction and the candidate road segment direction; the transition probability and directional continuity are weighted and fused to obtain the priority score of the candidate road segment.
8. The multi-dimensional adaptive trajectory compression method for road networks as described in claim 6, characterized in that... The encoding of the ranking of the actual next road segment in the candidate set in step S3 includes: if the ranking is 0th, then use 1 bit for encoding; if the ranking is 1st, then use 2 bits for encoding; if the ranking is 2nd, then use 3 bits for encoding; if the ranking is greater than 2, then use 4 bits followed by the Rice-encoded ranking value; if the actual next road segment is not in the candidate set, then directly store the original ID of the road segment; the direction encoding based on direction continuity is: calculate the turning direction of the trajectory at three consecutive nodes, encode the turning direction into a Q-ary bit string, and the compression cost is the total number of bits after encoding.
9. A multi-dimensional adaptive trajectory compression method for road networks as described in claim 1, characterized in that... Step S4 includes adaptive distance compression based on speed prediction for the distance field along the road: calculate the displacement along the road between adjacent trajectory points, predict the current displacement using the displacement and time interval of the previous two trajectory points and calculate the prediction residual, adaptively quantize the prediction residual, and perform zero residual run-length encoding on the quantized residual sequence; compare with quantization-based Elf compression, and select the scheme with the lowest compression cost for encoding.
10. A multi-dimensional adaptive trajectory compression method for road networks as described in claim 9, characterized in that... The method for calculating the displacement along the road in step S4 is as follows: if two adjacent trajectory points are on the same road segment, the displacement is equal to the difference in the distances along the road between the two points; if two adjacent trajectory points are on different road segments, the displacement is equal to the sum of the remaining length of the previous road segment and the distance along the road in the current road segment.
