A method and apparatus for optimizing a distance traveled

By using a two-stage processing mechanism to remove GPS drift points and call the map API to compensate for missing road segments, the problem of signal drift and missing points in vehicle mileage calculation is solved, achieving high-precision and high-reliability mileage calculation.

CN123045397APending Publication Date: 2026-11-06HANGZHOU MIKE DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611276621.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-21
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

Existing technologies for calculating vehicle mileage suffer from GPS signal drift and loss, leading to results that deviate from the actual values ​​and making it difficult to guarantee accuracy and completeness under complex road conditions.

Method used

A two-stage processing mechanism is adopted. First, abnormal points are eliminated by using the Haversine formula and velocity-time cross-validation. Then, the planned path is obtained by calling a third-party map API for compensation, generating the compensation mileage.

Benefits of technology

It significantly improves the accuracy and reliability of vehicle mileage calculation, solves the mileage deviation problem caused by GPS drift and signal loss, and ensures high-precision calculation under various complex road conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123045397A_ABST
    Figure CN123045397A_ABST
Patent Text Reader

Abstract

The application discloses a kind of mileage distance optimization method and device, including the following steps: obtaining the original point sequence based on vehicle mileage positioning, which includes longitude and latitude coordinates, time stamp and instantaneous speed;The original point sequence is preprocessed to obtain the sorted point sequence;The sorted point sequence after preprocessing is rejected to obtain the effective point set, the drift point in the effective point set, the effective mileage and the corrected mileage not including the mileage corresponding to the drift point in the effective mileage;Each drift point is compensated to obtain the compensated mileage;The compensated mileage and the corrected mileage are superimposed to output total mileage.The beneficial effect: the missing section mileage is intelligently filled, and the mileage undercounting problem is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of vehicle data processing technology, and in particular to a method and apparatus for mileage and distance optimization. Background Technology

[0002] In enterprise vehicle management and mobility service scenarios, vehicle mileage calculation typically relies on trajectory point data collected by onboard positioning devices. Existing technologies mainly employ methods such as GPS point linear accumulation, map API path reconstruction, or speed-time integration for calculation. However, in practical applications, GPS signals are susceptible to location drift caused by factors such as building obstruction, multipath effects, and atmospheric interference, resulting in mileage calculations based on point accumulation significantly deviating from the actual value. Furthermore, in scenarios with signal loss, such as tunnels or under viaducts, existing solutions lack effective compensation mechanisms, leading to underestimation of mileage. Moreover, single data source processing methods struggle to simultaneously address location drift removal and signal loss compensation, failing to guarantee the accuracy and completeness of mileage calculations under complex road conditions. Summary of the Invention

[0003] Purpose of the invention: The purpose of this invention is to solve the technical problems in the prior art and to provide a method and apparatus for optimizing mileage distance.

[0004] Technical solution: In the first aspect, this application proposes a mileage distance optimization method, including the following steps:

[0005] Obtain the raw location sequence based on vehicle mileage positioning, including latitude and longitude coordinates, timestamps, and instantaneous speed;

[0006] The original point sequence is preprocessed to obtain a sorted point sequence;

[0007] Abnormal points are removed from the preprocessed and sorted point sequence to obtain the set of valid points, the drift points in the set of valid points, the valid mileage, and the mileage to be corrected that does not include the mileage corresponding to the drift points in the valid mileage.

[0008] The compensation mileage is obtained by compensating for each of the drift points;

[0009] The total mileage is output by superimposing the compensated mileage and the mileage to be corrected.

[0010] Preferably, the original point sequence is preprocessed, including:

[0011] Determine whether the number of points in the original point sequence is greater than or equal to two; if not, stop the process.

[0012] If so, the original point sequence is sorted in ascending order according to the timestamp to obtain a sorted point sequence.

[0013] Preferably, outlier points are removed from the preprocessed and sorted point sequence to obtain a set of valid points, drift points in the set of valid points, valid mileage, and mileage to be corrected that does not include the mileage corresponding to drift points in the valid mileage, including:

[0014] The positioning mileage is obtained by calculating the distance between each adjacent point in the sorted point sequence using the Haversine formula, where adjacent points include previous points and the current point.

[0015] The theoretical travel distance is calculated by comparing the instantaneous speed of the preceding point with the time interval between the current point and the adjacent point.

[0016] The absolute value of the difference between the location mileage and the theoretical driving distance is calculated and compared with the offset threshold. If the offset threshold requirement is met, the current location is included in the set of valid locations, and the corresponding location mileage is accumulated as the valid mileage. If the requirement is not met, the current location is removed.

[0017] Preferably, the absolute value of the difference between the calculated location mileage and the theoretical driving distance is compared with an offset threshold. If the threshold requirement is met, the current location is included in the set of valid locations; otherwise, the current location is removed, including:

[0018] When the difference is less than or equal to the offset threshold, the current location is determined to be a valid location and included in the set of valid locations. The corresponding positioning mileage is then accumulated as the valid mileage.

[0019] When the difference is greater than the offset threshold, the current point is determined to be an abnormal point, the point is removed from the point sequence, the corresponding positioning mileage is not accumulated, and the point is skipped so that the next point and the previous point continue to be judged as abnormal points.

[0020] Preferably, if the removed point is the last point in the point sequence, then the point is recorded as a valid point and retained in the set of valid points.

[0021] Preferably, the method for determining the drift point is as follows:

[0022] If the positioning mileage between adjacent points included in the set of valid points exceeds a preset threshold or the time interval between adjacent points exceeds a preset time threshold, then the positioning mileage corresponding to that point is removed from the set of valid point mileage, and the mileage to be corrected is obtained. The point is then determined to be a drift point.

[0023] Preferably, the compensation mileage is obtained by compensating for each of the drift points, including:

[0024] Obtain the latitude and longitude coordinates of the drift point and its corresponding preceding point;

[0025] Call a third-party map API to access the latitude and longitude coordinates of the drifting point and its corresponding preceding point;

[0026] Obtain the polyline coordinate sequence of the planned path between two points based on a third-party map;

[0027] Generate a compensation point sequence and corresponding timestamps based on the polyline coordinate point sequence;

[0028] The compensation mileage is obtained by calculating the cumulative distance between any two adjacent points in the compensation point sequence using the Haversine formula based on the location information.

[0029] Preferably, generating a compensation point sequence based on the polyline coordinate point sequence includes:

[0030] The time interval is obtained based on the drift point and its corresponding preceding point. The unit is an integer number of seconds;

[0031] According to the uniform step size in the sequence of broken line coordinate points sampling The number of coordinate points is denoted as the compensation point sequence.

[0032] Preferably, the timestamps corresponding to the compensation point sequence are generated based on the polyline coordinate point sequence, including the following formula:

[0033] ;

[0034] ;

[0035] in, This is the timestamp of the nth coordinate point in the polyline coordinate point sequence. Here, n is the timestamp of the preceding point in the drift coordinate sequence, and n is the coordinate index in the polyline coordinate sequence. To achieve uniform step size, It is the sum of all step sizes of the polyline coordinate point sequence.

[0036] Secondly, this application proposes a mileage distance optimization device, comprising:

[0037] The acquisition unit is used to acquire the raw location sequence based on vehicle mileage positioning, including latitude and longitude coordinates, timestamps, and instantaneous speed;

[0038] The preprocessing unit is used to preprocess the original point sequence to obtain a sorted point sequence;

[0039] The elimination unit is used to eliminate abnormal points in the preprocessed and sorted point sequence to obtain the effective point set, the drift points in the effective point set, the effective mileage, and the mileage to be corrected that does not include the mileage corresponding to the drift points in the effective mileage.

[0040] A compensation unit is used to compensate for each of the drift points to obtain a compensation mileage;

[0041] The output unit is used to superimpose the compensated mileage and the mileage to be corrected to output the total mileage.

[0042] Thirdly, this application proposes an electronic device including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and when the computer program is executed by the processor, the processor causes the processor to perform the method described in the above embodiments.

[0043] Fourthly, this application proposes a computer-readable storage medium storing a computer program. When the computer program described in the above embodiments is executed by a processor, it implements the method described in the above embodiments.

[0044] Beneficial Effects: The technical solution provided in this application significantly improves the accuracy of vehicle mileage calculation by constructing a two-stage processing mechanism of anomaly point removal and drift point compensation. On the one hand, by utilizing cross-validation of Haversine geometric distance and speed-time theoretical distance, combined with a configurable offset threshold, it can accurately identify and remove anomaly points caused by GPS drift, effectively avoiding inflated mileage. On the other hand, for scenarios with missing signals or abnormal intervals, by calling the map API to obtain the planned path and performing point interpolation compensation based on uniform time steps, it realizes intelligent filling of missing road segment mileage, solving the problem of under-calculation. At the same time, the endpoint protection mechanism and strict timestamp alignment algorithm ensure the integrity and temporal continuity of trajectory data, enabling the final output total mileage to maintain high accuracy and high reliability under various complex road conditions. Attached Figure Description

[0045] Figure 1 This is a schematic diagram of the method according to an embodiment of the present invention;

[0046] Figure 2 This is a schematic diagram of the system structure provided in an embodiment of the present invention.

[0047] Figure 3 This is a block diagram of an electronic device structure provided in one embodiment of this application. Detailed Implementation

[0048] To make the technical solution of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0049] Example 1:

[0050] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions in the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention. Unless otherwise defined, the technical or scientific terms used herein should have the ordinary meaning understood by those skilled in the art. The terms "including" and similar expressions used herein mean that the element or object preceding the term covers the element or object listed after the term and its equivalents, but do not exclude other elements or objects.

[0051] In response to the problems existing in the current technology, such as Figure 1-2 As shown, a distance optimization method is proposed, including the following steps:

[0052] S100. Obtain the raw location sequence based on vehicle mileage positioning, including latitude and longitude coordinates, timestamps, and instantaneous speed;

[0053] Specifically, the original point sequence typically originates from real-time trajectory data collected by vehicle-mounted GPS terminals, BeiDou positioning modules, or mobile devices. This embodiment simultaneously acquires three types of multi-dimensional information for each discrete original point data point: spatial location (latitude and longitude), time dimension (timestamp), and motion state (instantaneous velocity). This provides a complete data foundation for subsequent data cross-validation. For example, the instantaneous velocity field can be used to estimate the theoretical driving distance, which can then be compared with the geometric distance calculated based on latitude and longitude. This fusion of multi-source information is a prerequisite for identifying abnormal data.

[0054] S200: Preprocess the original point sequence to obtain a sorted point sequence;

[0055] Specifically, due to data transmission delays or caching mechanisms, the received raw location data may be out of sequence. This step reconstructs the true timeline of vehicle travel by arranging the location sequence in ascending order according to timestamps, ensuring the logical correctness of subsequent calculations of distances and time intervals between adjacent locations and avoiding mileage calculation errors caused by time sequence discrepancies.

[0056] S300, Remove abnormal points from the preprocessed sorted point sequence to obtain a set of valid points, drift points in the set of valid points, valid mileage, and mileage to be corrected that does not include the mileage corresponding to drift points in the valid mileage.

[0057] Specifically, this is the first stage of the data cleaning process in this application. Outlier points refer to noise points that significantly deviate from the true trajectory due to GPS multipath effects, signal reflections, etc. Removing these points prevents inflated mileage. Valid points are track points that have been verified and confirmed as reliable; the mileage corresponding to the continuous path formed by these points is the valid mileage. It is important to note that drift points in this application are a broader concept, encompassing not only points with abnormally changing positioning coordinates but also, more broadly, target points or road segments in the valid point sequence that cannot be directly calculated by straight-line connections due to signal loss, sampling interruptions, or abnormal intervals, requiring targeted compensation. By separating and separately marking these points from the valid mileage calculation, clear anchor points are provided for subsequent accurate compensation.

[0058] S400: Compensate for each drift point to obtain a compensated mileage; that is, the compensated mileage calculated for each drift point is superimposed. For the drift points identified in step S300, the system no longer relies on the original unreliable positioning data, but introduces external reference information (such as path planning data from a third-party map service) to reconstruct the driving trajectory of that road segment. The compensated mileage generated in this way can effectively fill the mileage gaps caused by signal blind spots such as tunnels and under viaducts, solving the problem of underestimating mileage in signal loss scenarios using traditional methods.

[0059] S500 outputs the total mileage by superimposing the compensated mileage and the mileage to be corrected.

[0060] Specifically, the compensation mileage here refers to the compensation mileage generated in step S400 above. The system merges and adds the mileage to be corrected (excluding the mileage corresponding to the drift point, which is not compensated or corrected) from the effective mileage with the mileage of the missing road segment obtained from reconstruction (compensation mileage) to obtain the final total mileage.

[0061] Through the above-mentioned two-stage processing mechanism, this embodiment eliminates drift noise that causes inflated mileage by using multi-dimensional data cross-validation on the one hand, and fills the signal gap that causes underestimation of mileage on the other hand through intelligent compensation. Thus, it can output high-precision mileage calculation results under various complex road conditions, which is significantly better than the traditional single straight-line accumulation or pure map restoration scheme.

[0062] In some specific embodiments, the original point sequence is preprocessed, including:

[0063] Determine whether the number of points in the original point sequence is greater than or equal to two; if not, stop the process.

[0064] If so, the original point sequence is sorted in ascending order by timestamp to obtain a sorted point sequence. Specifically, mileage calculation is essentially the integration or accumulation of a continuous trajectory, requiring at least two points to constitute a displacement vector. When the number of data points in the obtained original point sequence is less than two, the system lacks the basic geometric elements for distance calculation. In this case, the process is terminated directly and zero mileage or an invalid flag is returned, which avoids program crashes caused by array out-of-bounds errors or division by zero errors in subsequent algorithms, thus improving the robustness of the system. At the same time, since the vehicle terminal may experience out-of-order data packets due to signal delays, buffer retransmissions, etc. during network transmission, if the timestamps are not sorted in ascending order, processing directly according to the receiving order will misjudge the points with reversed timestamps as the vehicle's violent back-and-forth movement, resulting in a large amount of false mileage. By forcibly executing the timestamp ascending order sorting, the real spatiotemporal reference of the vehicle's movement is reconstructed, ensuring the physical authenticity of the time intervals and displacement calculations between subsequent adjacent points.

[0065] In some specific embodiments, outlier points are removed from the preprocessed and sorted point sequence to obtain a set of valid points, drift points in the set of valid points, valid mileage, and mileage to be corrected that does not include the mileage corresponding to drift points in the valid mileage, including:

[0066] The positioning mileage is obtained by calculating the distance between each adjacent point in the sorted point sequence using the Haversine formula, where adjacent points include previous points and the current point.

[0067] The theoretical travel distance is calculated by comparing the instantaneous speed of the preceding point with the time interval between the current point and the adjacent point.

[0068] The absolute value of the difference between the location mileage and the theoretical driving distance is calculated and compared with the offset threshold. If the offset threshold requirement is met, the current location is included in the set of valid locations, and the corresponding location mileage is accumulated as the valid mileage. If the requirement is not met, the current location is removed.

[0069] Specifically, this step constructs a cleaning mechanism based on dual verification of geometry and kinematics. Positioning mileage is the actual spatial span between two points calculated based on a model of the Earth's sphere, reflecting the vehicle's absolute position change; while theoretical driving distance is the expected displacement derived from the instantaneous speed and time interval of preceding points, reflecting the vehicle's relative motion state. Under normal driving conditions, these two should be highly consistent. When GPS signals experience multipath reflection or obstruction drift, positioning mileage will abruptly change, while speed data is usually relatively stable or changes continuously, leading to a significant increase in the difference between the two. This embodiment utilizes this characteristic difference, comparing the absolute value of the difference with a preset offset threshold to accurately identify abnormal points deviating from the true trajectory. For example, the offset threshold can be set to 300 meters, meaning that if the actual GPS position of a point deviates from its theoretical position calculated based on speed by more than 300 meters, then that point is determined to have a positioning drift risk. It should be understood that the Haversine formula is only a preferred example for calculating spherical distances in this application. In other embodiments, the Vincenty formula or the Great-circle distance formula can also be used as alternatives, as long as the accurate calculation of the distance between two points on the Earth's surface can be achieved. Similarly, the offset threshold is not limited to a fixed value and can be dynamically configured according to vehicle type, road segment level, or historical data statistical characteristics to adapt to the accuracy requirements in different scenarios.

[0070] In some specific embodiments, the absolute value of the difference between the calculated location mileage and the theoretical driving distance is compared with an offset threshold. If the threshold requirement is met, the current location is included in the set of valid locations; otherwise, the current location is removed.

[0071] When the difference is less than or equal to the offset threshold, the current location is determined to be a valid location and included in the set of valid locations. The corresponding positioning mileage is then accumulated as the valid mileage.

[0072] When the difference exceeds the offset threshold, the current point is determined to be an abnormal point. This point is removed from the point sequence, its corresponding positioning mileage is not accumulated, and the point is skipped, allowing the next point to continue the abnormal point removal process with the preceding points. Specifically, this "skipping abnormal points and continuing with the preceding valid points" mechanism is crucial for ensuring trajectory continuity. When the current point P(i) is detected as an abnormal drift point, the system not only removes it from the valid sequence but, more importantly, in subsequent comparisons, directly associates the next point to be detected, P(i+1), with the previously confirmed valid point P(i-1) for verification. This is because the drift point P(i) itself is unreliable. If P(i) is still used as a benchmark to verify P(i+1), it is highly likely that an incorrect benchmark will cause the originally normal P(i+1) to be misjudged as abnormal, leading to a chain reaction of trajectory breaks. By tracing back to the nearest valid anchor point, the system can overcome noise interference and correctly assess whether subsequent points have returned to the normal trajectory, thereby preserving the true driving path information to the greatest extent and avoiding the problem of the entire valid trajectory being erroneously discarded due to single-point drift.

[0073] In some specific embodiments, if the removed point is the last point in the point sequence, it is recorded as a valid point and retained in the set of valid points. Specifically, this is a special protection strategy for the end of a journey. In actual business scenarios, the end point of a vehicle's journey often corresponds to deterministic events such as order completion, engine shutdown, or geofence triggering. Its coordinate information usually has high business credibility or legal validity as a basis for settlement. Even if the end point's verification difference with the previous valid point exceeds the offset threshold due to signal attenuation or environmental interference, simply removing it will result in the recorded trajectory not covering the complete end of the journey, causing underestimation of mileage or missing business data loops. Therefore, this embodiment forcibly retains the point at the end of the sequence, ensuring that regardless of its positioning quality, it can participate in the final mileage accumulation as the end marker of the journey. This design reflects that while pursuing algorithmic accuracy, the technical solution also takes into account the completeness and determinism of business logic, preventing the negative effects of excessive cleaning from a purely technical perspective.

[0074] In some specific embodiments, the method for determining the drift point is as follows:

[0075] If the positioning mileage between adjacent points included in the set of valid points exceeds a preset threshold or the time interval between adjacent points exceeds a preset time threshold, then the positioning mileage corresponding to that point is removed from the set of valid point mileage, and the mileage to be corrected is obtained. The point is then determined to be a drift point.

[0076] Specifically, the drift points here physically represent signal loss sections or abnormally long intervals caused by environmental obstructions during vehicle travel, such as tunnel crossings, driving under overpasses, or signal recovery sections after prolonged parking. Unlike single-point coordinate jumps caused by multipath effects, this type of drift manifests as a spatial or temporal span between two reliable valid anchor points that does not conform to normal driving logic. For example, a preset threshold can be set to 1000 meters, and a preset time threshold can be set to 120 seconds. When the system detects that the straight-line distance between adjacent valid points exceeds 1000 meters, or the timestamp difference exceeds 120 seconds, it determines that there is a risk of data loss within that interval. At this time, the system will deduct the mileage of any possible straight-line connection in that interval from the total valid mileage and mark it as an object to be compensated. This triggering mechanism based on dual thresholds of distance and time can accurately cover various signal blind spot scenarios, preventing underestimation of mileage due to simple straight-line connections or overestimation of mileage due to abnormally long intervals, and providing accurate input anchor points for subsequent path reconstruction.

[0077] In some specific embodiments, compensation is performed on each of the drift points to obtain a compensation mileage, including:

[0078] Obtain the latitude and longitude coordinates of the drift point and its corresponding preceding point;

[0079] Call a third-party map API to access the latitude and longitude coordinates of the drifting point and its corresponding preceding point;

[0080] Obtain the polyline coordinate sequence of the planned path between two points based on a third-party map;

[0081] Generate a compensation point sequence and corresponding timestamps based on the polyline coordinate point sequence;

[0082] The compensation mileage is obtained by calculating the cumulative distance between any two adjacent points in the compensation point sequence using the Haversine formula based on the location information.

[0083] Specifically, this step reconstructs the driving trajectory from an abstract signal gap. The system first extracts the effective coordinates of the two ends of the drifting segment as the start and end points, and then sends a route planning request to a third-party map service. It should be understood that the third-party map API can be any interface that provides driving route planning services, such as the open platforms of navigation service providers like Gaode Maps, Baidu Maps, or Tencent Maps; this application does not limit this. Crucially, the system obtains not just the total distance between two points, but a polyline sequence of ordered latitude and longitude coordinates. This sequence describes the geometric path the vehicle might actually traverse in the road network. Subsequently, the system generates a time-dependent compensation point sequence based on this geometric path and uses the Haversine formula to cumulatively add the distances between adjacent points in the compensation point sequence segment by segment, thereby obtaining a compensation mileage that conforms to the actual road shape. This approach avoids the potential algorithmic black box problem of directly using the estimated distance returned by the map API, ensuring the consistency and transparency of the mileage calculation logic with the overall technical framework of this application.

[0084] In some specific embodiments, generating a compensation point sequence based on the polyline coordinate point sequence includes:

[0085] The time interval is obtained based on the drift point and its corresponding preceding point. The unit is an integer number of seconds;

[0086] According to the uniform step size in the sequence of broken line coordinate points sampling The number of coordinate points is denoted as the compensation point sequence.

[0087] Specifically, the core of this step lies in establishing a mapping relationship between spatial paths and the time dimension. Among these, This represents the actual travel time of the vehicle in the signal-deficient section; rounding it down facilitates discretization sampling. Uniform step size. The calculation formula is ,in This is the sum of all step lengths for the polyline coordinate sequence, i.e., the total length of the planned path returned by the map API. Physically speaking, This characterizes the average virtual speed (m / s) of the vehicle within the compensated road segment. (The text abruptly ends here, likely due to an incomplete sentence or missing information.) Sampling is performed on the broken line sequence with a step size, and the number of sampling points is limited. In essence, the system performs spatiotemporal normalization on the static map path according to the actual driving time. This design ensures that the density of the generated compensation points is consistent with the sampling frequency of the original GPS data in the time dimension, avoiding mileage calculation deviations or time axis distortions caused by uneven distribution of map path points (such as too dense at curves and too sparse at straight sections), so that the compensation data can truly reflect the vehicle's driving process.

[0088] In some specific embodiments, the timestamps corresponding to the compensation point sequence are generated based on the polyline coordinate point sequence, including the following formula:

[0089] ;

[0090] ;

[0091] in, This is the timestamp of the nth coordinate point in the polyline coordinate point sequence. Here, n is the timestamp of the preceding point in the drift coordinate sequence, and n is the coordinate index in the polyline coordinate sequence. To achieve uniform step size, It is the sum of all step sizes of the polyline coordinate point sequence.

[0092] Specifically, the formula defines the precise generation rules for the time attributes of compensation points. As a time reference anchor point, it ensures seamless connection between the start time of the compensated section and the preceding valid trajectory. As the index n increases from 1 to... Timestamp of each compensation point Strictly follow the uniform step size Linear accumulation. Because the total number of sampling points is limited to... When n reaches its maximum value, the timestamp of the last compensation point will naturally approach the timestamp of the subsequent valid points, thus mathematically guaranteeing the continuity and closure of the compensation segment and the original trajectory along the time axis. This strict time alignment mechanism eliminates the time discontinuity problem common in traditional path replacement schemes, ensuring that the merged complete trajectory data is not only spatially continuous but also maintains a strict monotonically increasing characteristic in the time dimension, providing a reliable data foundation for subsequent time-based business analysis (such as speeding detection and stop analysis). Finally, the system treats the generated compensation point sequence as a virtual real trajectory, applies the Haversine formula to its adjacent points to accumulate the distances, and the result is the compensation mileage of the drift segment, which is then superimposed with the valid mileage obtained above to output the total mileage.

[0093] In other embodiments of the invention, combined with Figure 2 This invention discloses a mileage distance optimization device, comprising:

[0094] The acquisition unit 201 is used to acquire the original point sequence based on vehicle mileage positioning, including latitude and longitude coordinates, timestamps and instantaneous speed;

[0095] Preprocessing unit 202 is used to preprocess the original point sequence to obtain a sorted point sequence;

[0096] The elimination unit 203 is used to eliminate abnormal points in the preprocessed sorted point sequence to obtain a set of valid points, drift points in the set of valid points, valid mileage, and mileage to be corrected that does not include the mileage corresponding to the drift points in the valid mileage.

[0097] Compensation unit 204 is used to compensate for each of the drift points to obtain the compensation mileage;

[0098] Output unit 205 is used to superimpose the compensated mileage and the mileage to be corrected to output the total mileage.

[0099] In other embodiments of the present invention, an electronic device 400 is disclosed, such as... Figure 3 As shown, the electronic device may include: one or more processors 401; a memory 402; a display 403; one or more application programs (not shown); and one or more computer programs 404. These devices can be connected via one or more communication buses 405. The one or more computer programs 404 are stored in the memory 402 and configured to be executed by the one or more processors 401. The one or more computer programs 404 include instructions that can be used to perform actions such as... Figure 1 And the steps in the corresponding embodiments.

[0100] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0101] In the various embodiments of this invention, the functional units can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0102] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as flash memory, portable hard disk, read-only memory, random access memory, magnetic disk, or optical disk.

[0103] The above description is merely a specific implementation of the embodiments of the present invention, but the protection scope of the embodiments of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiments of the present invention should be covered within the protection scope of the embodiments of the present invention. Therefore, the protection scope of the embodiments of the present invention should be determined by the protection scope of the claims.

Claims

1. A mileage distance optimization method, characterized in that, Includes the following steps: Obtain the raw location sequence based on vehicle mileage positioning, including latitude and longitude coordinates, timestamps, and instantaneous speed; The original point sequence is preprocessed to obtain a sorted point sequence; Abnormal points are removed from the preprocessed and sorted point sequence to obtain the set of valid points, the drift points in the set of valid points, the valid mileage, and the mileage to be corrected that does not include the mileage corresponding to the drift points in the valid mileage. The compensation mileage is obtained by compensating for each of the drift points; The total mileage is output by superimposing the compensated mileage and the mileage to be corrected.

2. The method according to claim 1, characterized in that, The original point sequence is preprocessed, including: Determine whether the number of points in the original point sequence is greater than or equal to two; if not, stop the process. If so, the original point sequence is sorted in ascending order according to the timestamp to obtain a sorted point sequence.

3. The method according to claim 1, characterized in that, Abnormal points are removed from the preprocessed and sorted point sequence to obtain a set of valid points, drift points in the set of valid points, valid mileage, and mileage to be corrected that does not include the mileage corresponding to drift points in the valid mileage, including: The positioning mileage is obtained by calculating the distance between each adjacent point in the sorted point sequence using the Haversine formula, where adjacent points include previous points and the current point. The theoretical travel distance is calculated by comparing the instantaneous speed of the preceding point with the time interval between the current point and the adjacent point. The absolute value of the difference between the location mileage and the theoretical driving distance is calculated and compared with the offset threshold. If the offset threshold requirement is met, the current location is included in the set of valid locations, and the corresponding location mileage is accumulated as the valid mileage. If the requirement is not met, the current location is removed.

4. The method according to claim 3, characterized in that, The absolute value of the difference between the located mileage and the theoretical driving distance is calculated and compared with an offset threshold. If the threshold requirement is met, the current location is included in the set of valid locations; otherwise, the current location is removed, including: When the difference is less than or equal to the offset threshold, the current location is determined to be a valid location and included in the set of valid locations. The corresponding positioning mileage is then accumulated as the valid mileage. When the difference is greater than the offset threshold, the current point is determined to be an abnormal point, the point is removed from the point sequence, the corresponding positioning mileage is not accumulated, and the point is skipped so that the next point and the previous point continue to be judged as abnormal points.

5. The method according to claim 3, characterized in that, If the removed point is the last point in the point sequence, then the point is recorded as a valid point and retained in the set of valid points.

6. The method according to claim 2, characterized in that, in, The method for determining the drift point is as follows: If the positioning mileage between adjacent points included in the set of valid points exceeds a preset threshold or the time interval between adjacent points exceeds a preset time threshold, then the positioning mileage corresponding to that point is removed from the set of valid point mileage, and the mileage to be corrected is obtained. The point is then determined to be a drift point.

7. The method according to claim 1, characterized in that, For each of the drift points, compensation mileage is obtained by compensation, including: Obtain the latitude and longitude coordinates of the drift point and its corresponding preceding point; Call a third-party map API to access the latitude and longitude coordinates of the drifting point and its corresponding preceding point; Obtain the polyline coordinate sequence of the planned path between two points based on a third-party map; Generate a compensation point sequence and corresponding timestamps based on the polyline coordinate point sequence; The compensation mileage is obtained by calculating the cumulative distance between any two adjacent points in the compensation point sequence using the Haversine formula based on the location information.

8. The method according to claim 7, characterized in that, Generate a compensation point sequence based on the polyline coordinate point sequence, including: The time interval is obtained based on the drift point and its corresponding preceding point. The unit is an integer number of seconds; According to the uniform step size in the sequence of broken line coordinate points sampling The number of coordinate points is denoted as the compensation point sequence.

9. The method according to claim 8, characterized in that, The timestamps corresponding to the compensation point sequence are generated based on the polyline coordinate point sequence, including the following formula: ; ; in, This is the timestamp of the nth coordinate point in the polyline coordinate point sequence. Here, n is the timestamp of the preceding point in the drift coordinate sequence, and n is the coordinate index in the polyline coordinate sequence. To achieve uniform step size, It is the sum of all step sizes of the polyline coordinate point sequence.

10. A mileage distance optimization device, characterized in that, include: The acquisition unit is used to acquire the raw location sequence based on vehicle mileage positioning, including latitude and longitude coordinates, timestamps, and instantaneous speed; The preprocessing unit is used to preprocess the original point sequence to obtain a sorted point sequence; The elimination unit is used to eliminate abnormal points in the preprocessed and sorted point sequence to obtain the effective point set, the drift points in the effective point set, the effective mileage, and the mileage to be corrected that does not include the mileage corresponding to the drift points in the effective mileage. A compensation unit is used to compensate for each of the drift points to obtain a compensation mileage; The output unit is used to superimpose the compensated mileage and the mileage to be corrected to output the total mileage.