Gps track completion method based on historical track and related device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI SHENXUE SUPPLY CHAIN MANAGEMENT CO LTD
- Filing Date
- 2026-05-06
- Publication Date
- 2026-08-04
AI Technical Summary
在实际运行中,由于卫星信号遮挡、车载终端离线、采样频率波动等原因,所上报的GPS轨迹普遍存在采样点稀疏、相邻点之间出现大段空白的情形,使得原始轨迹与车辆的真实行驶路线出现明显偏离,无法直接用于以路径完整性为前提的业务计算
[0041] 1. By performing a blank segment judgment on road segments that meet the time or distance thresholds between adjacent trajectory points, performing triple constraint screening on trajectory points of historical trajectories on the same route, and performing point filling by selecting one of the batch or recursive completion branches, the broken sparse GPS trajectory is only partially filled in the broken segments. The point filling is close to the actual driving habits of vehicles. After the completion, the overlap between the trajectory and the actual driving path reaches the accuracy level that can be directly used for compliance verification of logistics trajectory.
Smart Images

Figure CN122506593A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of GPS trajectory data processing, and in particular to a GPS trajectory completion method and related apparatus based on historical trajectories. Background Technology
[0002] GPS trajectory data is the foundation for mileage settlement, route verification, and compliance auditing in the logistics and transportation industry. The completeness and accuracy of the GPS trajectory point sequences continuously reported by vehicles during transportation directly affect subsequent business settlement and regulatory decisions. In actual operation, due to factors such as satellite signal obstruction, offline vehicle terminals, and fluctuations in sampling frequency, the reported GPS trajectories generally suffer from sparse sampling points and large gaps between adjacent points. This causes the original trajectory to deviate significantly from the vehicle's actual driving route, making it unsuitable for direct use in business calculations that rely on route integrity.
[0003] For sparse and fragmented GPS tracks, current repair and completion techniques mainly fall into the following categories, each with limitations in addressing the fragmentation problem simultaneously. One category is map-based snapping technology, which matches sparse track points to the nearest road network link. While this can determine route affiliation, it only corrects the positions of existing track points and doesn't add intermediate points to the fragmented sections; the fragmentation itself isn't eliminated. Another category is geometric interpolation technology based on straight lines or curves, which generates intermediate points between the ends of the fragmented section using mathematical models. While this fills in the gaps, the generation process doesn't depend on actual driving habits and road directions, resulting in significant deviations between the generated intermediate points and the actual path, especially noticeable in scenarios involving curves, ramps, and detours. A third category is historical track reuse technology, which replaces the current sparse track with a complete historical track of the same route. While this introduces real path information, it doesn't perform local completion for missing sections. When the start and end points of the current task, detour deviations, and historical tracks differ, it can easily cause misalignment of the entire route, actually reducing the overlap. In addition, existing point selection processes often fail to set uniform spatial and positional constraints for candidate points, which can easily lead to excessive lateral offsets, points that exceed reasonable driving ranges, or points that are too densely distributed, resulting in the completed trajectory still failing to meet the standards in terms of accuracy and smoothness.
[0004] The above-mentioned approaches share common limitations: they cannot perform local completion of broken road segments without destroying the complete trajectory segment, and they cannot simultaneously meet the requirements of closely reflecting actual vehicle driving habits and real road directions, having clear and executable spatial screening constraints for candidate point selection, and providing quantifiable evaluation of completion quality. Summary of the Invention
[0005] In order to implement local completion of broken road sections with clear constraints and close to the real path, and to output quantifiable trajectory quality evaluation indicators, this application provides a GPS trajectory completion method and related device based on historical trajectories.
[0006] Firstly, this application provides a GPS trajectory completion method and related apparatus based on historical trajectories, which adopts the following technical solution:
[0007] To perform locally complete, well-constrained, and realistic path-like completion of fragmented sparse GPS trajectories, and to output quantifiable trajectory quality evaluation indicators, this application provides a GPS trajectory completion method and related apparatus based on historical trajectories.
[0008] Firstly, this application provides a GPS trajectory completion method based on historical trajectories, employing the following technical solution:
[0009] A GPS trajectory completion method based on historical trajectories includes the following steps:
[0010] S1. Traverse adjacent trajectory points in the original GPS trajectory, and perform a blank segment determination for each pair of adjacent trajectory points. The blank segment determination includes: in response to the time interval between adjacent trajectory points exceeding a preset time threshold or the spatial distance exceeding a preset distance threshold, mark the road segment between adjacent trajectory points as a blank segment to be filled. The blank segment to be filled takes the previous trajectory point as the starting endpoint and the next trajectory point as the ending endpoint.
[0011] S2. Obtain several historical trajectories along the same route as the original GPS trajectory from the historical trajectory database, and extract trajectory points from these historical trajectories to form a candidate point set.
[0012] S3. Perform triple constraint screening on the candidate points in the candidate point set to obtain a valid candidate point set. The triple constraint screening includes: verifying whether the vertical distance from the candidate point to the corresponding line segment of the blank segment to be filled meets the preset vertical distance condition; verifying whether the projection ratio of the candidate point on the corresponding line segment of the blank segment to be filled falls within the preset projection ratio range; and verifying whether the distance between the candidate point and the selected filling point meets the preset density condition.
[0013] S4. Based on the length characteristics of the blank segment to be filled, select one branch from the batch completion branch and the recursive completion branch to perform point filling processing on the effective candidate point set to obtain the point filling sequence. Insert the point filling sequence into the original GPS trajectory in the order from the start endpoint to the end endpoint along the blank segment to be filled to obtain the completed trajectory. The recursive completion branch generates the point filling sequence by using the effective candidate point with the projection ratio closest to the midpoint of the line segment as the recursive midpoint and performing recursive binary search on the blank segment to be filled.
[0014] S5. Perform road network adsorption on the completed trajectory to obtain the benchmark adsorption trajectory corresponding to the completed trajectory; compare the completed trajectory with the benchmark adsorption trajectory, calculate the trajectory quality index to reflect the fitting quality of the completed trajectory, the trajectory quality index shall include at least one of the following: geometric overlap dimension, direction consistency dimension and speed reasonable dimension between the completed trajectory and the benchmark adsorption trajectory, and output the qualification judgment result of the completed trajectory based on the trajectory quality index.
[0015] By adopting the above technical solution, the following steps are taken: S1 first defines the local range for filling points only at the break point by determining the blank segment to be filled; S2 locks the candidate point set from the historical trajectory of the same route as the source of filling points that closely resembles the actual path; S3 uses triple constraints to filter out invalid candidate points that have excessive lateral offset, fall into the extension line, or are too densely distributed; S4 selects one of the batch filling branch and recursive filling branch to perform the filling point processing based on the length characteristics of the blank segment; and S5 uses multi-dimensional trajectory quality indicators to give a quantifiable qualification judgment on the completed trajectory. These five steps form a closed-loop local filling link, so that the filling of points in the broken road segment is not only close to the actual driving habits of vehicles, but also has clear and executable spatial screening constraints and quantifiable quality evaluation standards.
[0016] Optionally, in S2, the conditions for obtaining several historical trajectories along the same route include: the running route of the historical trajectory along the same route matches the start and end points of the original GPS trajectory, and the running direction of the historical trajectory along the same route is consistent with the running direction of the original GPS trajectory; the formation of the candidate point set in S2 also includes: performing over-dense filtering on the trajectory points in several historical trajectories along the same route where the distance between adjacent trajectory points is less than a preset over-dense distance threshold, so as to remove over-densely distributed trajectory points.
[0017] By adopting the above technical solution, in the S2 stage, the matching of the origin and destination points and the consistency of the running direction are used as the criteria for the same route. The trajectory points with excessively close adjacent spacing in the historical trajectory are filtered in advance, so that the candidate point set excludes non-same direction, non-same route and redundant dense trajectory points at the source, reducing the amount of invalid calculation in the subsequent triple constraint screening.
[0018] Optionally, in S3: the vertical distance condition is that the vertical distance from the candidate point to the corresponding line segment of the blank segment to be filled is less than the preset vertical distance threshold; the projection ratio interval is a closed interval [0, 1], and the projection ratio falling within the closed interval [0, 1] indicates that the projection point of the candidate point is located inside the corresponding line segment of the blank segment to be filled rather than on the extension line; the density condition is that the distance between the candidate point and the selected filling point is not less than the preset minimum distance threshold.
[0019] By adopting the above technical solution, the horizontal offset of the supplementary points is controlled by the vertical distance threshold, the candidate points falling on the extension line of the line segment are eliminated by the projection ratio constraint of the closed interval [0,1], and the distribution of supplementary points is avoided by the minimum spacing threshold. The triple constraint locks the horizontal, vertical and density validity boundaries of the supplementary points in one step.
[0020] Optionally, in S4, the batch completion branch includes: from the set of valid candidate points, in order of increasing projection ratio of each valid candidate point on the corresponding line segment of the blank segment to be completed, the valid candidate points are sequentially determined as the completion points in the completion point sequence; the recursive completion branch includes sub-steps S41-S43: S41. Select the valid candidate point whose projection ratio is closest to the ratio corresponding to the midpoint of the line segment from the set of valid candidate points as the recursive midpoint of the current recursive layer; S42. Using the recursive midpoint as the dividing point, split the blank segment to be completed into a front sub-segment with the starting endpoint and the recursive midpoint as endpoints, and a back sub-segment with the recursive midpoint and the ending endpoint as endpoints; S43. Perform blank segment determination on the front sub-segment and the back sub-segment respectively. In response to the front sub-segment or the back sub-segment being determined as a blank segment to be completed, the sub-segment determined as a blank segment to be completed is taken as the blank segment to be completed in the next recursive layer and returned to S41, until the front sub-segment and the back sub-segment are no longer determined as blank segments to be completed.
[0021] By adopting the above technical solution, the batch completion branches are laid out in order of projection ratio to adapt to shorter or simple blank segments. The recursive completion branches are laid out layer by layer to approximate the real path according to "midpoint optimization + binary recursion" to adapt to longer or more complex blank segments. This enables S4 to have two independent and landable completion paths in the engineering implementation, so as to undertake blank segments with different length characteristics to be completed respectively.
[0022] Optionally, the selection of batch completion branches and recursive completion branches in S4 includes: obtaining the length features of the blank segment to be completed, the length features including at least one of the spatial length of the line segment corresponding to the blank segment to be completed and the time span corresponding to the blank segment to be completed; in response to the length features not exceeding a preset branch switching threshold, selecting a batch completion branch to perform point completion processing on the valid candidate point set; in response to the length features exceeding the branch switching threshold, selecting a recursive completion branch to perform point completion processing on the valid candidate point set.
[0023] By adopting the above technical solution, the system automatically determines whether to use a batch completion branch or a recursive completion branch based on the spatial length or time span of the blank segment to be filled. This allows short blank segments to be filled quickly in a low-overhead batch manner, while long blank segments are approximated to the actual path using a divide-and-conquer recursive approach. The completion overhead and completion accuracy are adaptively allocated according to the actual complexity of the blank segment.
[0024] Optionally, S41 further includes performing a secondary path rationality check on the selected recursive midpoint; the secondary path rationality check includes: calculating the angle between the direction vector corresponding to the previous sub-segment and the direction vector corresponding to the subsequent sub-segment, and calculating the curvature abrupt change of the line segment corresponding to the blank segment to be filled in by the polyline formed by the starting endpoint, the recursive midpoint and the ending endpoint; in response to the angle exceeding a preset angle threshold or the curvature abrupt change exceeding a preset abrupt change threshold, the next candidate point is selected from the set of valid candidate points in order of proximity to the projection ratio and the corresponding ratio of the line segment midpoint, and the secondary path rationality check is performed again, until the angle does not exceed the preset angle threshold and the curvature abrupt change does not exceed the preset abrupt change threshold.
[0025] By adopting the above technical solution, a secondary verification of the direction angle and curvature change amount is superimposed on the geometrically optimal midpoint corresponding to the midpoint of the line segment with the projection ratio closest to the midpoint. This ensures that the recursive midpoint avoids falling into the historical point of the wrong branch in scenarios such as curves, ramps, and forks. The path direction of the completed trajectory is consistent with the actual direction of the road.
[0026] Optionally, S2 further includes performing candidate source weighted filtering on several historical trajectories along the same route. Candidate source weighted filtering includes: for each historical trajectory along the same route, calculating the trajectory difference degree between the spatially corresponding non-blank segments of the historical trajectory and the original GPS trajectory, and removing the historical trajectory along the same route from the several historical trajectories if the trajectory difference degree exceeds a preset difference degree threshold; assigning temporal weights to the remaining historical trajectories along the same route based on the proximity of their acquisition time to the acquisition time of the original GPS trajectory, with the temporal weights serving as the ranking criteria for the selection priority of each trajectory point in the candidate point set; S2 also includes a candidate source size safety net: if the number of remaining historical trajectories along the same route after removal is lower than a preset minimum sample size threshold, expanding the candidate sources to adjacent historical trajectories in the same region whose directional angle with the original GPS trajectory is less than a preset directional angle threshold, and marking the task of performing the GPS trajectory completion method based on historical trajectories as a low sample size task.
[0027] By adopting the above technical solutions, pollution history trajectories across seasons, vehicle types, and drivers are filtered by "non-blank segment trajectory similarity". "Time-series weighting" prioritizes recent historical trajectories in the candidate point set. Adjacent route expansion is used as a fallback to address the cold start situation of insufficient new route samples, so that the candidate point set has both purity and coverage in both quality and quantity dimensions.
[0028] Optionally, S3 also includes adaptive and downgraded rollback processing for road segments with triple constraint filtering: based on the road segment type of the segment to be filled, at least one threshold from the preset threshold table is selected for the vertical distance condition, projection ratio range, and density condition corresponding to the road segment type. The road segment type includes at least urban road segment type, expressway road segment type, and mountain road segment type. In response to the empty set of effective candidate points after triple constraint filtering according to the selected threshold, a three-level downgrade rollback is performed in sequence: density condition relaxation, projection ratio range relaxation, and geometric interpolation fallback. The points filled in by the downgrade rollback are assigned a low confidence label. The trajectory quality indicators in S5 include overlap index, direction consistency index, and speed rationality index. The overlap index is determined based on the completed trajectory and... The percentage of the overlapping mileage of the baseline adsorption trajectory relative to the fitted mileage is determined. The directional consistency index is determined based on the deviation between the directional vector of the completed trajectory and the directional vector of the baseline adsorption trajectory. The velocity rationality index is determined based on the degree of deviation of the implicit velocity between adjacent completion points from the reasonable range of the historical velocity distribution. S5 also includes the linkage relaxation of the qualification thresholds of the overlap index, directional consistency index, and velocity rationality index based on the low confidence label. In response to the fact that the task of performing the GPS trajectory completion method based on the historical trajectory is marked as a low sample size task, the linkage relaxation further relaxes the qualification thresholds based on the low sample size task label, and outputs the corresponding confidence level of the completed trajectory according to the hit of the qualification threshold after linkage relaxation.
[0029] By adopting the above technical solutions, the dynamic switching of the triple constraint threshold is driven by the road segment type to adapt to different road segments such as narrow urban roads, long straight highways, and mountain road curves. The three-level degradation backoff avoids the inability to complete the task due to an empty set of effective candidate points in extreme working conditions. The multi-dimensional qualification threshold relaxes the linkage between low confidence point completion and low sample size tasks, so that the qualification judgment of the completion output is not only based on the result indicators but also combined with the credibility level of the point completion process.
[0030] Secondly, the computer device provided in this application adopts the following technical solution:
[0031] A computer device comprising:
[0032] One or more processors;
[0033] Memory;
[0034] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to:
[0035] Perform the GPS trajectory completion method based on historical trajectories described above.
[0036] Thirdly, this application provides a computer-readable storage medium that adopts the following technical solution:
[0037] A computer-readable storage medium storing a computer program that can be loaded by a processor and executed as described above.
[0038] The storage medium stores at least one instruction, at least one program, a code set, or an instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the following:
[0039] The above-mentioned GPS trajectory completion method based on historical trajectories.
[0040] In summary, this application includes at least one of the following beneficial technical effects:
[0041] 1. By performing a blank segment judgment on road segments that meet the time or distance thresholds between adjacent trajectory points, performing triple constraint screening on trajectory points of historical trajectories on the same route, and performing point filling by selecting one of the batch or recursive completion branches, the broken sparse GPS trajectory is only partially filled in the broken segments. The point filling is close to the actual driving habits of vehicles. After the completion, the overlap between the trajectory and the actual driving path reaches the accuracy level that can be directly used for compliance verification of logistics trajectory.
[0042] 2. By using the projection ratio of the closed interval [0,1] and the vertical distance threshold to lock the reasonable position of the supplementary point within the line segment, using the minimum spacing threshold to avoid the supplementary point being too dense, and using "midpoint optimization + binary recursion" to gradually approximate the real path on the long blank segment, the completion process has clear and executable engineering constraints on the three levels of supplementary point position, density and approximation path, avoiding the supplementary points that are too laterally offset, too densely distributed or deviate from the path at the curve.
[0043] 3. By filtering candidate historical trajectories with non-blank segment difference and time sequence weight, dynamically switching triple constraint thresholds with road segment type, using three-level downgrade backoff to deal with situations where no candidates are available under extreme conditions, and using multi-dimensional trajectory quality indicators combined with low confidence labels and low sample size markings to relax the qualified threshold, the completion process has a complete engineering closed loop in four aspects: historical trajectory purity, threshold adaptability, usability under extreme conditions, and result credibility assessment. Attached Figure Description
[0044] Figure 1 This is a schematic diagram illustrating the application environment of the GPS trajectory completion method based on historical trajectories in one embodiment of the present invention.
[0045] Figure 2 This is a flowchart of the GPS trajectory completion method based on historical trajectories in one embodiment of the present invention.
[0046] Figure 3 This is a schematic diagram of the geometric relationship of triple constraint screening in one embodiment of the present invention.
[0047] Figure 4 This is a schematic diagram illustrating the relationship between the completion points of batch completion branches and recursive completion branches in one embodiment of the present invention.
[0048] Figure 5 This is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation
[0049] The present application will be further described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the scope of the application.
[0050] See Figure 1 and Figure 2 This application provides a GPS trajectory completion method based on historical trajectories, including steps S1-S5. The method takes the GPS trajectory continuously reported by the vehicle terminal as input, uses historical trajectories of the same route stored in the historical trajectory database as the source of completion points, performs local completion on the trajectory completion server for broken segments appearing in the original GPS trajectory, and outputs a quantifiable pass / fail judgment result using the benchmark absorbed trajectory after road network absorption as a reference.
[0051] like Figure 1 As shown, the vehicle-mounted terminal is installed on the logistics vehicle. During the vehicle's operation, it continuously collects the vehicle's position coordinates and collection time at a set sampling frequency, reporting them to the trajectory completion server in the form of GPS trajectory points. The server saves the GPS trajectory point sequence of each task as the original GPS trajectory for that task. The historical trajectory library is connected to the trajectory completion server, storing complete GPS trajectories that have been reported and archived from multiple previous tasks, categorized and indexed by operating route and direction. Internally, the trajectory completion server is functionally divided into a blank segment detection module, a candidate point construction module, a constraint filtering module, a point completion execution module, and a quality verification module. Each module is further divided into... Figure 2 The method shown sequentially processes the original GPS trajectory for this task.
[0052] For ease of description, a brief explanation of some terms involved in the subsequent steps will be provided first.
[0053] In the original GPS trajectory, large gaps between adjacent trajectory points due to sampling frequency fluctuations, satellite signal obstruction, or terminal offline issues are identified and defined as blank segments to be filled. The two endpoints of the blank segments to be filled are denoted as the start endpoint and the end endpoint, respectively. Trajectory points from historical trajectories along the same route in the historical trajectory database are extracted to form a candidate point set. After triple constraint screening, the remaining trajectory points in the candidate point set form the valid candidate point set. Several trajectory points selected in a certain order from the valid candidate point set constitute the completion point sequence. The completion point sequence is inserted into the original GPS trajectory to obtain the completed trajectory. The reference trajectory obtained by absorbing the completed trajectory into the road network is called the baseline absorbed trajectory. The comparison between the completed trajectory and the baseline absorbed trajectory is quantified to form a trajectory quality index.
[0054] The following is a detailed explanation of each step.
[0055] S1. Traverse adjacent trajectory points in the original GPS trajectory and perform a blank segment judgment for each pair of adjacent trajectory points.
[0056] Specifically, adjacent trajectory points in the original GPS trajectory are extracted in chronological order. The difference between the timestamp of the previous trajectory point and the timestamp of the next trajectory point is used as the time interval between adjacent trajectory points, and the Euclidean distance between the position coordinates of the previous trajectory point and the position coordinates of the next trajectory point is used as the spatial distance between adjacent trajectory points. In response to the time interval exceeding a preset time threshold or the spatial distance exceeding a preset distance threshold, the road segment between the pair of adjacent trajectory points is marked as a blank segment to be filled, with the previous trajectory point as the starting endpoint and the next trajectory point as the ending endpoint.
[0057] In one specific embodiment, the time threshold is set to 2 minutes and the distance threshold is set to 1 kilometer. In the original GPS trajectory, the time interval between a pair of adjacent trajectory points is 5 minutes and the spatial distance is 3.2 kilometers, both of which exceed the corresponding thresholds. This segment is marked as a blank segment to be completed. The time interval between another pair of adjacent trajectory points is 30 seconds and the spatial distance is 200 meters, both of which do not exceed the thresholds. This segment belongs to the complete trajectory segment and will not proceed to subsequent steps.
[0058] After S1 traversal, an original GPS track is divided into several blank segments to be filled and several complete track segments. Subsequent steps S2 to S5 only execute each blank segment to be filled independently, while the complete track segments do not participate in the point filling process, so that the parts of the original GPS track that were not broken in the original track remain unchanged during the completion process.
[0059] S2. Obtain several historical trajectories along the same route as the original GPS trajectory from the historical trajectory database, and extract trajectory points from these historical trajectories to form a candidate point set.
[0060] Specifically, historical trajectories that meet the same route condition as the original GPS trajectory of the current task are selected from the historical trajectory database as historical trajectories along the same route. Then, the trajectory points of each historical trajectory along the same route are added to the candidate point set one by one. In a specific embodiment, 10 recently archived historical trajectories along the same route are selected as candidate sources for this completion.
[0061] In some embodiments, the conditions for obtaining historical trajectories along the same route include origin-end point matching and running direction consistency. Origin-end point matching means that the distance between the origin-end point positions of the historical trajectory along the same route and the origin-end point positions of the original GPS trajectory does not exceed a preset origin-end point tolerance radius, for example, 50 meters. Running direction consistency means that the angle between the overall running direction vector of the historical trajectory along the same route and the overall running direction vector of the original GPS trajectory does not exceed a preset direction angle threshold, for example, 30°. In addition, during the formation stage of the candidate point set, over-density filtering can be performed. In response to the distance between adjacent trajectory points in the same historical trajectory along the same route being less than a preset over-density distance threshold (for example, 5 meters), over-density trajectory points are merged or removed, thus eliminating redundant and dense trajectory points from the candidate point set at the source.
[0062] In some embodiments, S2 further includes performing candidate source weighted filtering on several historical trajectories along the same route. The purpose of candidate source weighted filtering is to exclude contaminated historical trajectories that cross seasons, vehicle types, or drivers, and to give more recently collected historical trajectories a higher selection priority in the candidate point set. Specifically, for each historical trajectory along the same route, the trajectory difference degree between the spatially corresponding portion of the historical trajectory and the non-blank segment of the original GPS trajectory is calculated relative to the non-blank segment, using discrete Friesian distance or Hausdorff distance as a metric. The larger the difference degree value, the greater the deviation between the two trajectory segments. In response to a trajectory difference degree greater than a preset difference degree threshold (e.g., 50 meters), the historical trajectory along the same route is removed from the candidate sources. For the remaining historical trajectories along the same route after removal, a temporal weight is assigned based on the proximity of their collection time to the collection time of the original GPS trajectory. The temporal weight is determined according to an exponential decay function, i.e.:
[0063]
[0064] in, For time series weights, The attenuation coefficient is... This is the difference between the acquisition time of historical trajectories along the same route and the acquisition time of the current task. In a specific embodiment, the attenuation coefficient is taken as... The weighting is obtained by collecting historical trajectories of the same route with a time difference of 7 days⁻¹. Weights are obtained from historical trajectories of the same route with a time difference of 0 days. The temporal weight serves as the ranking criterion for selecting trajectory points from several historical trajectories along the same route to enter the candidate point set, thus placing trajectory points from recently collected historical trajectories along the same route at a higher position in the candidate point set.
[0065] In some embodiments, S2 also includes a backup candidate source size to address the cold start scenario of insufficient new route samples. In response to the number of remaining historical trajectories of the same route after weighted filtering of candidate sources being lower than a preset minimum sample size threshold (e.g., 3), the candidate sources are expanded to include historical trajectories of adjacent routes in the same region whose directional angle with the original GPS trajectory is less than a preset directional angle threshold (e.g., 30°). The expanded adjacent historical trajectories are marked as expanded samples and assigned relatively low temporal weights. Simultaneously, the task of performing the GPS trajectory completion method based on historical trajectories is marked as a low sample size task, and this marking participates in the relaxation of the qualifying threshold in stage S5.
[0066] S3. Perform triple constraint screening on the candidate points in the candidate point set to obtain the effective candidate point set.
[0067] See Figure 3 Let the starting endpoint of the blank segment to be filled be . The termination endpoint is A candidate point in the candidate point set is The triple constraint screening includes vertical distance constraint, projection scale constraint, and density constraint.
[0068] Candidate points Online segment Projection scale Calculate using the following formula:
[0069]
[0070] Candidate points to line segment perpendicular distance of the line Calculate using the following formula:
[0071]
[0072] in, as the starting endpoint Point to candidate point The vector, as the starting endpoint Point to the terminal endpoint The vector, Candidate points Online segment The projection ratio on Candidate points to line segment The perpendicular distance to the line in which it is located.
[0073] Specifically, vertical distance constraint refers to The vertical distance is less than a preset threshold, for example, 1 kilometer; the projection ratio constraint refers to... Falling in a closed interval Inside, the projection scale falls on Internal characterization candidate points The projection point is located on the line segment The interior of the candidate point, rather than its extension line; density constraint refers to the candidate point... The distance between the candidate point and the selected replacement point is not less than a preset minimum distance threshold, for example, 100 meters. When all three constraints are satisfied, the candidate point... It is added to the set of valid candidate points.
[0074] In a specific example of numerical substitution, let the starting endpoint be... meters, termination point Meters, candidate points Meters, calculated according to the above formula , rice, Falling Inside, For distances less than 1 kilometer, vertical distance and projection scale constraints are applied; candidate points are then validated. With the selected supplementary points Spacing between The distance (in meters, rounded to one decimal place) is less than the minimum spacing threshold of 100 meters, therefore the density constraint was not met, and the candidate point was rejected. Removed.
[0075] In some embodiments, S3 further includes adaptive processing of road segments with triple constraint filtering. Considering the significant differences in lateral offset tolerance for different road segment types, such as narrow urban roads, long straight highways, and mountain curves, at least one of the following thresholds—vertical distance condition, projection ratio range, and density condition—is selected from a preset threshold table based on the road segment type of the segment to be filled: vertical distance threshold 200 meters, projection ratio range, and density condition. In a specific embodiment, the threshold table is configured as follows: vertical distance threshold 200 meters for urban road segment types, projection ratio range, and density condition, etc. Minimum spacing threshold: 50 meters; Vertical distance threshold corresponding to highway section type: 1 kilometer; Projection ratio range. Minimum spacing threshold: 200 meters; Vertical distance threshold corresponding to mountain road section type: 500 meters; Projection ratio range. The minimum spacing threshold is 30 meters. The road segment type can be inferred from map attribute labels or point density statistics of historical trajectories along the same route.
[0076] In some embodiments, S3 further includes a degradation rollback process after triple constraint screening to handle extreme conditions. In response to the fact that the effective candidate point set is empty after triple constraint screening according to the selected threshold, a three-level degradation rollback is performed sequentially: Level 1, the density condition is relaxed from the minimum spacing threshold of 100 meters to 30 meters; Level 2, if the set is still empty after Level 1 degradation, the projection ratio range is changed from... Relaxed to The third level, if the value remains empty after the second level downgrade, performs a geometric linear interpolation fallback between the start and end endpoints, i.e., it applies the equidistant rule to the line segment. Several supplementary points were inserted. All supplementary points generated during this downgrade rollback carried a low-confidence label, which participated in the relaxation of the qualification threshold in the S5 stage.
[0077] S4. Based on the length characteristics of the blank segment to be filled, select one branch from the batch completion branch and the recursive completion branch to perform point filling processing on the effective candidate point set to obtain the point filling sequence. Then, insert the point filling sequence into the original GPS trajectory in the order from the starting endpoint to the ending endpoint along the blank segment to be filled to obtain the completed trajectory.
[0078] See Figure 4 The relationship between the completion points of batch completion branches and recursive completion branches is as follows.
[0079] Batch completion of branches generates a sequence of completion points in a one-time, phased manner. Specifically, from the set of valid candidate points, the completion points are selected according to the projection ratio of each valid candidate point onto the corresponding line segment of the blank segment to be completed. The valid candidate points are determined as the complement points in the complement point sequence in ascending order.
[0080] The recursive completion branch generates the completion point sequence in the manner of "midpoint optimization + binary recursion", including sub-steps S41-S43.
[0081] S41. Select from the set of valid candidate points the projection ratio closest to the ratio corresponding to the midpoint of the line segment (i.e., ... The valid candidate points are used as the recursion midpoints of the current recursive layer.
[0082] S42. Using the recursion midpoint as the dividing point, split the blank segment to be filled into a first sub-segment with the starting endpoint and the recursion midpoint as endpoints, and a second sub-segment with the recursion midpoint and the termination endpoint as endpoints.
[0083] S43. Perform the blanking segment determination for the preceding and following sub-segments respectively. In response to the preceding or following sub-segment being determined as a blanking segment, the sub-segment determined as a blanking segment is taken as the blanking segment of the next recursive layer and returned to S41, until the preceding and following sub-segments are no longer determined as blanking segments.
[0084] In a specific embodiment, the termination condition for the recursive completion branch is that the time span of the sub-segment does not exceed 2 minutes and the spatial length does not exceed 1 kilometer, which is consistent with the time threshold and distance threshold in S1. When a sub-segment generated by a certain recursive layer satisfies both of these conditions, the sub-segment is no longer determined as a blank segment to be completed, and the recursion terminates on that branch.
[0085] In some embodiments, the selection of the batch completion branch and the recursive completion branch in S4 is adaptively performed based on the length characteristics of the blank segment to be completed. Specifically, the length characteristics of the blank segment to be completed are obtained, including at least one of the spatial length of the line segment corresponding to the blank segment and the time span corresponding to the blank segment; in response to the length characteristics not exceeding a preset branch switching threshold, the batch completion branch is selected to perform point completion processing on the valid candidate point set; in response to the length characteristics exceeding the branch switching threshold, the recursive completion branch is selected to perform point completion processing on the valid candidate point set. In a specific embodiment, the spatial length component of the branch switching threshold is 5 kilometers and the time span component is 30 minutes, that is, when the spatial length of the blank segment does not exceed 5 kilometers and the time span does not exceed 30 minutes, the batch completion branch is used; when either component exceeds the corresponding threshold, the recursive completion branch is used.
[0086] In some embodiments, S41 further includes performing a secondary verification of the path rationality of the selected recursive midpoint to avoid the recursive midpoint falling into a historical point on an incorrect branch in scenarios such as curves, ramps, and forks. Specifically, it calculates the angle between the direction vector corresponding to the preceding sub-segment and the direction vector corresponding to the following sub-segment. And calculate the curvature abrupt change of the corresponding line segment for the blank segment to be filled in by the polyline formed by the starting endpoint, recursive midpoint, and ending endpoint; in response to the included angle If the angle exceeds a preset threshold (e.g., 120°) or the curvature abrupt change exceeds a preset threshold, the next candidate point is selected from the set of valid candidate points in order of proximity to the projection ratio and the corresponding ratio of the midpoint of the line segment, and the path rationality is checked again until the angle does not exceed the preset threshold and the curvature abrupt change does not exceed the preset threshold.
[0087] The following two sets of specific numerical substitution examples illustrate the execution process of batch branch completion and recursive branch completion, respectively.
[0088] Example 1 (Batch completion of branches): The starting endpoint of the blank segment to be completed. meters, termination point The blank segment has a spatial length of 1 kilometer and a time span of 5 minutes, both of which do not exceed the branch switching thresholds of 5 kilometers for spatial length and 30 minutes for time span. Therefore, batch branch completion is selected. After triple constraint filtering by S3, the effective candidate point set is... Each valid candidate point is on the line segment The projection scales are 0.25, 0.50, and 0.75, respectively. Sort by projection scale from smallest to largest, the supplementary point sequence is as follows: , , After inserting it into the original GPS track, we get The completed trajectory.
[0089] Example 2 (Recursive Completion Branch): The starting endpoint of the blank segment to be completed meters, termination point The time span is 20 minutes. The spatial length of the blank segment is 10 kilometers, and the spatial length component exceeding the branch switching threshold is 5 kilometers. Therefore, recursive branch completion is selected. S41 selects the valid candidate point with the projection ratio closest to 0.5. The projection ratio is 0.48, which serves as the recursion midpoint of the current recursive layer. S42 uses... Using this as the dividing point, split the blank segment into the preceding sub-segment. (Spatial length approximately 4.8 kilometers, time span approximately 9.6 minutes) and subsequent segments (The spatial length is approximately 5.2 kilometers, and the time span is approximately 10.4 minutes). S43 performs a blank segment determination on each of the two sub-segments: the first sub-segment, with a spatial length of 4.8 kilometers exceeding 1 kilometer and a time span of 9.6 minutes exceeding 2 minutes, is determined to be a blank segment to be filled and returns to S41 as the blank segment to be filled in the next recursive layer for continued binary division; the second sub-segment is similarly determined to be a blank segment to be filled and continues binary division. This process is recursively applied layer by layer until the spatial length of all final sub-segments does not exceed 1 kilometer and the time span does not exceed 2 minutes.
[0090] S5. Perform road network adsorption on the completed trajectory to obtain the benchmark adsorption trajectory corresponding to the completed trajectory; compare the completed trajectory with the benchmark adsorption trajectory, calculate the trajectory quality index to reflect the fitting quality of the completed trajectory, and output the qualification judgment result of the completed trajectory based on the trajectory quality index.
[0091] Specifically, road network snapping is performed on each trajectory point in the completed trajectory, that is, each trajectory point is matched to the nearest road network link, so that the position coordinates of each trajectory point are corrected to the corresponding position of the matched road network link. The sequence of matched trajectory points forms the baseline snapped trajectory. The trajectory quality index includes at least the overlap index, which is calculated by the following formula:
[0092]
[0093] Among them, the fitted mileage is the cumulative length of the completed trajectory, and the overlapping mileage is the cumulative length of the completed trajectory and the baseline adsorption trajectory overlapping on the road network link.
[0094] The following two sets of specific implementation data illustrate the effect of this method on improving the overlap index.
[0095] Example 1: The vehicle terminal's backhaul rate for a certain mission was 66.67%. The fitted mileage of the original GPS trajectory was 13,802 meters, and the overlap mileage with the baseline adsorption trajectory was 8,181 meters, with an original overlap rate of approximately 59.3% (rounded to one decimal place). After completing the trajectory using this method, the fitted mileage of the completed trajectory was 16,631 meters, and the overlap mileage was 14,329 meters, with an overlap rate of approximately 86.2% (rounded to one decimal place).
[0096] Example 2: The original GPS trajectory of another task had an original overlap of 57.8%; after completing it using this method, the fitted mileage of the completed trajectory was 21,128 meters, the overlapping mileage was 20,999 meters, and the deviation mileage was 129 meters, with an overlap of approximately 99.4% (rounded to one decimal place).
[0097] In some embodiments, the trajectory quality indicators, in addition to the overlap index, also include a direction consistency index and a speed rationality index. The direction consistency index is determined based on the deviation between the direction vector of the completed trajectory and the direction vector of the reference absorbed trajectory. Specifically, it is the average angle between the direction vectors of the completed trajectory and the reference absorbed trajectory at corresponding positions; a smaller average angle indicates higher direction consistency. The speed rationality index is determined based on the degree of deviation of the implicit speed between adjacent supplementary points from the reasonable range of the historical speed distribution. Specifically, it is the position difference between adjacent supplementary points divided by the time difference as the implicit speed. If the implicit speed falls within the reasonable range of the historical speed distribution for that road segment, the speed rationality of the supplementary point is considered accurate. The speed rationality index is the proportion of all supplementary points that have achieved speed rationality accuracy.
[0098] In some embodiments, S5 further includes relaxing the qualifying thresholds for the overlap ratio, directional consistency, and speed reasonableness indicators based on the low-confidence label, and further relaxing the qualifying thresholds based on the low-sample-size label when the current task is marked as a low-sample-size task. In a specific embodiment, by default, the qualifying threshold for the overlap ratio is 80%, the qualifying threshold for the directional consistency indicator is 15°, and the qualifying threshold for the speed reasonableness indicator is 90%. When a low-confidence label is hit, the qualifying thresholds are relaxed by 5%, 5°, and 10%, respectively, i.e., the overlap ratio threshold drops to 75%, the directional consistency threshold rises to 20°, and the speed reasonableness threshold drops to 80%; when low-sample-size task labels are hit simultaneously, the qualifying thresholds are further relaxed by 5%, 5°, and 10%, respectively, i.e., the overlap ratio threshold drops to 70%, the directional consistency threshold rises to 25°, and the speed reasonableness threshold drops to 70%. After completion, the trajectory outputs the corresponding confidence level based on the hit rate of the relaxed pass threshold: if all three indicators are hit, the confidence level is L1; if two indicators are hit, the confidence level is L2; if one indicator is hit, the confidence level is L3; if none of them are hit, the trajectory is judged as unqualified and the rollback or redo of the completion process is triggered.
[0099] See Figure 5 This application also provides a computer device including a processor, a memory, and one or more application programs. The one or more application programs are stored in the memory and configured to be executed by the processor. These application programs are configured to perform the aforementioned GPS trajectory completion method based on historical trajectories. This application also provides a computer-readable storage medium storing at least one instruction, at least one program segment, a code set, or an instruction set. The at least one instruction, at least one program segment, code set, or instruction set is loaded and executed by the processor to implement the aforementioned GPS trajectory completion method based on historical trajectories.
[0100] The above are merely preferred embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0101] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0102] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A GPS trajectory completion method based on historical trajectories, characterized in that, Includes the following steps: S1. Traverse adjacent trajectory points in the original GPS trajectory, and perform a blank segment determination for each pair of adjacent trajectory points. The blank segment determination includes: in response to the time interval between adjacent trajectory points exceeding a preset time threshold or the spatial distance exceeding a preset distance threshold, marking the segment between the adjacent trajectory points as a blank segment to be filled. The blank segment to be filled is defined as the previous trajectory point as the starting endpoint and the next trajectory point as the ending endpoint. S2. Obtain several historical trajectories along the same route as the original GPS trajectory from the historical trajectory database, and extract trajectory points from the several historical trajectories along the same route to form a candidate point set; S3. Perform triple constraint filtering on the candidate points in the candidate point set to obtain a valid candidate point set, wherein the triple constraint filtering includes: verifying whether the vertical distance from the candidate point to the line segment corresponding to the blank segment to be filled meets a preset vertical distance condition; verifying whether the projection ratio of the candidate point on the line segment corresponding to the blank segment to be filled falls within a preset projection ratio range; and verifying whether the distance between the candidate point and the selected filling point meets a preset density condition. S4. Based on the length characteristics of the blank segment to be filled, select one branch from the batch completion branch and the recursive completion branch to perform point filling processing on the set of valid candidate points to obtain a point filling sequence. Insert the point filling sequence into the original GPS trajectory in the order from the starting endpoint to the ending endpoint along the blank segment to be filled to obtain the completed trajectory. The recursive completion branch generates the point filling sequence by using the valid candidate point with the projection ratio closest to the midpoint of the line segment as the recursive midpoint and performing recursive binary search on the blank segment to be filled. S5. Perform road network adsorption on the completed trajectory to obtain the reference adsorption trajectory corresponding to the completed trajectory; compare the completed trajectory with the reference adsorption trajectory, calculate the trajectory quality index to reflect the fitting quality of the completed trajectory, wherein the trajectory quality index includes at least one of the following: geometric overlap dimension, direction consistency dimension, and speed reasonable dimension between the completed trajectory and the reference adsorption trajectory, and output the qualification judgment result of the completed trajectory based on the trajectory quality index.
2. The GPS trajectory completion method based on historical trajectories according to claim 1, characterized in that, In S2, the conditions for obtaining the several historical trajectories along the same route include: the running route of the historical trajectory along the same route matches the start and end points of the original GPS trajectory, and the running direction of the historical trajectory along the same route is consistent with the running direction of the original GPS trajectory. The formation of the candidate point set in S2 further includes: performing over-dense filtering on the trajectory points in the several historical trajectories of the same line where the distance between adjacent trajectory points is less than a preset over-dense distance threshold, so as to remove over-densely distributed trajectory points.
3. The GPS trajectory completion method based on historical trajectories according to claim 1, characterized in that, In S3: The vertical distance condition is that the vertical distance from the candidate point to the line segment corresponding to the blank segment to be filled is less than a preset vertical distance threshold. The projection ratio range is a closed interval [0, 1]. A projection ratio falling within the closed interval [0, 1] indicates that the projection point of the candidate point is located inside the line segment corresponding to the blank segment to be filled, rather than on the extension line. The density condition is that the distance between the candidate point and the selected replacement point is not less than a preset minimum distance threshold.
4. The GPS trajectory completion method based on historical trajectories according to claim 1, characterized in that, In S4, the batch completion branch includes: from the set of valid candidate points, in order of increasing projection ratio of each valid candidate point on the line segment corresponding to the blank segment to be completed, the valid candidate points are sequentially determined as the completion points in the completion point sequence; The recursive completion branch includes the following sub-steps: S41. Select the effective candidate point whose projection ratio is closest to the ratio corresponding to the midpoint of the line segment from the set of effective candidate points as the recursive midpoint of the current recursive layer; S42. Using the recursion midpoint as the dividing point, split the blank segment to be filled into a front sub-segment with the starting endpoint and the recursion midpoint as endpoints, and a back sub-segment with the recursion midpoint and the termination endpoint as endpoints; S43. Perform the blanking segment determination on the preceding sub-segment and the following sub-segment respectively. In response to the preceding sub-segment or the following sub-segment being determined as a blanking segment, the sub-segment determined as a blanking segment is used as the blanking segment of the next recursive layer and the process returns to S41 until the preceding sub-segment and the following sub-segment are no longer determined as blanking segments.
5. The GPS trajectory completion method based on historical trajectories according to claim 4, characterized in that, The selection of the batch completion branch and the recursive completion branch in S4 includes: Obtain the length feature of the blank segment to be filled, wherein the length feature includes at least one of the spatial length of the line segment corresponding to the blank segment to be filled and the time span corresponding to the blank segment to be filled; In response to the length feature not exceeding a preset branch switching threshold, the batch completion branch is selected to perform point completion processing on the valid candidate point set; In response to the length feature exceeding the branch switching threshold, the recursive completion branch is selected to perform point completion processing on the valid candidate point set.
6. The GPS trajectory completion method based on historical trajectories according to claim 4, characterized in that, S41 further includes a secondary verification of the rationality of the selected recursive midpoint execution path; The secondary verification of path rationality includes: calculating the angle between the direction vector corresponding to the previous sub-segment and the direction vector corresponding to the subsequent sub-segment, and calculating the curvature change amount of the polyline formed by the starting endpoint, the recursive midpoint and the ending endpoint relative to the line segment corresponding to the blank segment to be filled; In response to the included angle exceeding a preset included angle threshold or the curvature mutation amount exceeding a preset mutation threshold, the next candidate point is selected from the set of valid candidate points in order of proximity to the projection ratio and the ratio corresponding to the midpoint of the line segment, and the path rationality secondary verification is performed again until the included angle does not exceed the preset included angle threshold and the curvature mutation amount does not exceed the preset mutation threshold.
7. The GPS trajectory completion method based on historical trajectories according to claim 1, characterized in that, S2 further includes performing candidate source weighted filtering on the plurality of historical trajectories along the same route; The candidate source weighted filtering includes: for each of the same historical trajectories, calculating the trajectory difference degree of the part of the same historical trajectory that spatially corresponds to the non-blank segment of the original GPS trajectory relative to the non-blank segment; and in response to the trajectory difference degree being greater than a preset difference degree threshold, removing the same historical trajectory from the plurality of same historical trajectories. The remaining historical trajectories along the same route after removal are assigned temporal weights based on the proximity of the acquisition time of the historical trajectories along the same route to the acquisition time of the original GPS trajectory. These temporal weights serve as the ranking criteria for the selection priority of each trajectory point in the candidate point set. S2 further includes a candidate source size fallback: in response to the number of remaining historical trajectories along the same route after elimination being lower than a preset minimum sample size threshold, the candidate sources are expanded to adjacent historical trajectories in the same region and whose directional angle with the running direction of the original GPS trajectory is less than a preset directional angle threshold, and the task of executing the GPS trajectory completion method based on historical trajectories is marked as a low sample size task.
8. The GPS trajectory completion method based on historical trajectories according to claim 1 or 7, characterized in that, The S3 also includes adaptive and downgraded rollback processing for road segments with triple constraint filtering: Based on the road segment type of the road segment where the blank segment to be filled is located, select at least one of the vertical distance condition, the projection ratio range and the density condition corresponding to the road segment type from the preset threshold table. The road segment type includes at least urban road segment type, expressway road segment type and mountain road segment type. In response to the fact that the set of valid candidate points is empty after the triple constraint screening is performed according to the selected threshold, a three-level downgrade backoff is performed in sequence, which includes density condition relaxation, projection ratio range relaxation, and geometric interpolation fallback, and the supplementary points generated by the downgrade backoff are assigned a low confidence label. The trajectory quality indicators in S5 include overlap index, direction consistency index, and speed rationality index. The overlap index is determined based on the proportion of the overlap mileage between the completed trajectory and the reference adsorption trajectory relative to the fitted mileage. The direction consistency index is determined based on the deviation between the direction vector of the completed trajectory and the direction vector of the reference adsorption trajectory. The speed rationality index is determined based on the degree of deviation of the implicit speed between adjacent supplementary points from the reasonable range of historical speed distribution. S5 further includes relaxing the pass thresholds of the overlap index, the direction consistency index, and the speed reasonableness index according to the low confidence label. In response to the task of executing the GPS trajectory completion method based on historical trajectory being marked as a low sample size task, the relaxation further relaxes the pass thresholds according to the marking of the low sample size task, and outputs the corresponding confidence level of the completed trajectory according to the hit of the relaxed pass threshold.
9. A computer device, characterized in that, It includes: One or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to: perform the GPS trajectory completion method based on historical trajectories according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the GPS trajectory completion method based on historical trajectories as described in any one of claims 1 to 8.