Abstract
For the current situation of the large error in civil satellite positioning data resulting in the calculation of smaller mileage by the polyline method than the actual mileage, a new method of mileage statistics has been proposed in this article. First, the original trajectory data are preprocessed to eliminate data errors. Second, based on the principle of shape approximation, it is preferred to implement the quadratic B-spline curve to accurately fit the mileage trajectory curve, comparing various curve fitting methods. Then, based on the trajectory curve control point data, the mileage statistics formula is derived, and the accurate mileage statistics method for non-precision satellite positioning signals is realized. Finally, the road test is carried out by using the photoelectric non-contact five-wheel instrument and GPS equipment. The polyline method and curve fitting method are used to generate contrastive curve and calculate the mileage, respectively. Taking photoelectric five-wheel data as the accurate mileage, the error analysis is carried out. The results show that the deviation between calculated and actual mileage values is less than 1%. Therefore, this method can meet the user’s requirements for fleet management.
Introduction
Mileage statistics is an important basis for vehicle maintenance, workload assessment, fuel consumption statistics, tire management, and fatigue driving warning in a fleet management. A normal mileage statistics method mainly includes the odometer measurement, the special instrument measurement, and the GPS measurement. Among them, the odometer data are easy to read, continuously available, and low cost. However, it also has the weakness of large error, poor real-time performance, and the possibility of data fraud due to its manual recording method. The special instrument measurement method usually adopts a photoelectric five-wheel system, and the measurement result is accurate and reliable. However, the cost of the equipment is high, and the installation and debugging are troublesome. It is only suitable for the experimental measurement of standard road sections but not suitable for fleet management. The mileage statistics based on GPS data is a low-cost method, which can automatically acquire data and is more accurate than the odometer method. So, it is considered to be the most popular way at present. However, due to the larger error of the original GPS data compared with the error by the special instrument, the data correction is required.1,2
At present, the positioning accuracy of civil GPS is about 10 m. Real-time kinematic (RTK) or GPS-based inertial navigation system (INS) can improve the positioning accuracy to the centimeter level. However, high-precision positioning systems are costly and not suitable for civilian applications.3,4 Zeng et al. 5 and Patire et al. 6 analyzed and studied the civil GPS signal error and the data fusion. Xie 7 and Li et al. 8 used the map matching method to process the GPS data and the broken-line method to calculate the mileage, and the error was between 3% and 5%. Most of the related research focuses on GPS trajectory data processing methods. In trajectory mileage statistics, they all use polygonal segments to generate trajectory line and then use the length accumulation method to calculate the mileage. Even so, all of them have not deduced the precise formula for calculating the mileage after trajectory fitting. Therefore, the current trajectory fitting and the mileage statistics methods are inadequate.9,10 In order to guarantee the precision of trajectory mileage, the second-order B-spline curve formula is used to fit the trajectory line based on the preprocessing of the original trajectory data. Besides, the precise mileage calculation formula is deduced, which provides a reference for the research of GPS trajectory data.
Trajectory data preprocessing
Trajectory lines normally consist of a series of position points, which are organized chronologically to describe the spatiotemporal locus movement of an object. Define any track Tr as
where pi = (longtitude, lattitude, timestamp) is the data structure of each track point, and the variables are longitude, latitude, and positioning time, respectively. The m track points p0 to pm–1 are distributed according to time series. The time interval of adjacent location points in the trajectory can be expressed as
The trajectory data errors mainly include the latitude and longitude errors caused by various factors, and the missing key points caused by
Static error point processing
Liu et al. 13 and Gong et al. 14 have done relevant research on GPS static drift point processing. Most of the literature uses the data filtering method for processing, which has a high probability of large error. In order to avoid large errors and simplify the calculation process, the gravity center method is adopted in this article.
Dift point identification
If the data obtained from GPS terminal equipment contain ACC (Accessory switch) which is a signal representing the engine switch, all GPS data which can indicate the engine shutdown state during a continuous time period can be regarded as zero drift data. If the engine switch signal is not obtained by GPS, the original GPS point data sequence needs to be judged. Zero drift point needs to satisfy two conditions, one is that the velocity is lower than the threshold in the continuous time period, and the other is that the direction information of each continuous coordinate point is inconsistent. That is to say, the data points satisfying the two conditions simultaneously in a certain period of time are identified as the zero drift data.
Drift point processing
1. Determine the coordinate values of discrete points in a new coordinate system.
GPS adopts the WGS84 coordinate system, which is not intuitive and complex in our calculation. Therefore, it is necessary to reset the coordinate origin and coordinate the original data in the new coordinate system. The coordinate value of the new coordinate origin in the WGS84 coordinate system is calculated according to the following equation
The new coordinate value of discrete points is calculated as follows
2. Construct a polygon and calculate the coordinates of the center of gravity.
Determine the quadrants of discrete points in the new coordinates and calculate the angle value, which is used as the sorting basis. After resorting, the data sequence is Ai(Xi, Yi) (i = 1, 2,…N) and connect each data point in the order of the angle value to form a polygon. According to the polygon area theorem, the polygon center of gravity position can be calculated.
Given theorem 1: the area of the N-edge polygon with Ai(Xi, Yi) (i = 1, 2…N) as the apex is (when the boundary A1, A2…An constitute a counterclockwise loop, take (+), and a clockwise loop takes (–))
The center of polygon gravity
According to the abovementioned method, the center of gravity coordinates of all the static drift discrete points in the new coordinate system can be calculated.
3. Calculate the original coordinate value of the point
Combine the trajectory data
Delete all identified drift points in the data sequence Tr, as Tr1. Taking the time value of the first point in the sequence of deleted drift points as the timestamp attribute value of G0(x0, y0) point and then inserted into Tr1. Reordering all points by timestamp attribute, and it is recorded as Tr2.
Taking the zero drift point processing as an example, the test vehicle stays for 1 h and the drift data points have 22 points. The contrasting trajectory before and after processing is shown in Figure 1.

Comparison of zero drift trajectory before and after processing.
Error point processing in motion
There are two types of singular points caused by unstable GPS signals during traveling, one is the large error points, and the other is the small error points deviating from the route. For large error points, the curvature elimination method or the three-point velocity threshold method is usually used for deletion. The curvature elimination method is more accurate in the case of highways or suburban roads with little curvature, but in urban roads, there is a risk of eliminating normal data when there is a right-angle or greater than right-angle turning.
15
In this article, the track line contains urban sections; therefore, three-point velocity threshold method is adopted to process large error points based on continuous positioning points. The specific methods have been reviewed in the literature.
16
For small deviation points, the geometric primitive method is usually used for identification first, and the detailed identification methods have been reviewed in the literature.17,18 Then, the deviation points are modified, and the arc projection algorithm is used to project the deviation point to the current section.
19
As shown in Figure 2, the deviation point is identified as M(xM, yM), and two adjacent data points without deviation are determined as A(xA, yA), B(xB, yB). Project point M on the line segment

Deviation points projection diagram.
The calculation method of the M′ point coordinates is as follows.
1. Calculate the angle
where
2. Calculate the projection distance of BM section on the road:
3. Calculate the projection coordinates of the offset point
Substitute
Because of the occlusion and location interval of GPS signal, there is a lack of key data in the GPS data sequence, which has a great impact on the trajectory curve and the mileage. The key missing data can be compensated according to the method in the literature.20,21
According to the abovementioned method, the track point data are processed. After the processing, the GPS data sequence is recombined. It is assumed that there are n + 1 track point data, the track sequence is denoted as
Trajectory curve fitting
Curve fitting is to minimize variance between the actual data and prediction data using a suitable regression approach.9,22 The methods of curve fitting mainly include Bessel curve, B-spline curve, parabolic adjustment curve, and cubic parameter spline curve. Parabolic and cubic spline curves require strict passing of feature points, which results from GPS positioning point errors, and so this method is not suitable for curve fitting of GPS positioning points. Bessel curve and B-spline curve methods do not pass all known points, the generated curve has the minimum sum of “distance” from all known points, and so they are suitable for curve fitting when there are errors in the known data points. Bessel curve passes through the starting point and end point, and its points have overall controllability. If some data point changes locally, the trajectory curve needs to be regenerated, and the calculation process is complicated. The B-spline curve is a kind of curve developed on the basis of the Bezier curve. It overcomes the inconvenience caused by the overall controllability of the Bezier curve, and the most commonly used are the quadratic and cubic B-spline curves. In terms of curve continuity, cubic is better than quadratic, cubic can achieve second derivative continuity, and in terms of the approximation of the generated polygon curve, the quadratic is better than cubic.23–25
In this part, according to the shape approximation, the trajectory curve is fitted by the quadratic B-spline method, which is designed for three discrete points, and the piecewise fitting method can be adopted for multiple GPS data points. Compared with the Bezier curve, a curve segment of piecewise quadratic B-spline is only related to the corresponding two broken line segments and three control polygon vertices. Changing one of the vertices only affects the three spline curve segments. Therefore, when the original positioning point may change, this method can reduce the computational complexity and increase the computing speed. However, the B-spline curve does not pass through the start and end points; therefore, the boundary processing is required in the curve fitting.
The elements in the trajectory are
Boundary processing
The B-spline curve has the following characteristics: the starting point is the midpoint of

The boundary processing schematic.
Realization of curve generation
Taking
Set the smoothness coefficient k, and segment the parameter t with the step length:
Trajectory mileage calculation
The quadratic B-spline curve is continuous and derivable on the parameter interval [0,1]. According to the arc length formula of parametric equation, it can be known that the arc length of the ith segment can be calculated by the following formula
Write formula (11) as the standard form of the quadratic B-spline parameter component equation
Deriving the parameter components in equation (13)
Substitute formula (12)
Let
When
Substitute
Suppose that the three control points of the ith curve are
Substituting
Experiment and result analysis
Test environment
The test vehicle is equipped with both a photoelectric non-contact five-wheel instrument and a GPS device, the GPS device uploads positioning data to the server through GPRS network, and users can obtain trajectory data through computer client, as shown in Figure 4. The photoelectric five-wheel instrument has a high precision used to measure speed and distance, which has an accuracy of ±0.5%, and the average value of five measurements on the same route is used as the standard mileage in the whole experiment. The A300 civil non-high-precision GPS device of Beijing Ding Technology Co, Ltd was selected in this experiment, the positioning interval is set as 30 s, the stall dormancy positioning interval is 120 s, and the heartbeat interval is 60 s. A road in Qingdao including urban roads and suburban expressway was chosen as the test route without tunnel culvert. The route is set as departure at point A (Start), getting to destination B (End), and then going back to point A. The stay times are as follows: 2 h before departure at A, 1 h on return at A, 2 h at B, and unlimited travel time. Five tests were conducted on the same route.

Diagram of test system.
Test result
A total of 1650 data were obtained from the five measurements, and each data includes the information of longitude, latitude, speed, altitude, and positioning time. The preprocessed results of one set of go and return measurements with 326 points are as follows: identify drift position point 2 and eliminate 178 drift data, identify 0 point with large error, identify and process a total of 46 small deviation points, and compensate 36 missing points. After processing, the data sequence is regenerated, totaling 163 points of data.
The broken line method is used to connect the trajectory points directly in time sequence, and the trajectory generated by this method is shown in Figure 5. The going trip is marked as red, and the return is blue. The total length (round trip) of all broken line segments is 40.99 km.

The trajectory line curve based on original data.
The trajectory curve generated using the secondary B-spline curve algorithm is shown in Figure 6. The new mileage statistics formula is used to calculate the mileage (including the going and return), and the result is 43.34 km.

The fitting trajectory curve based on processed data.
Result analysis
Curve fitting effect
In Figure 5, the trajectory is in the form of broken line segment. Due to the large interval between positioning points, the trajectory line is not smooth and poorly visible. Due to positioning error and GPS data loss, there is no overlap between the going and return curves, especially on the road sections with more turns. In Figure 6, the going and return trajectory lines go through the same route and basically coincide. The curve is smooth with better effect. The zero drift data points at the stop point have been reasonably processed. Error points and singular points data have been processed. The missing data at the intersection have been compensated. After comparing the two sets of curves, it is known that the fitting curve is closer to the original trajectory.
Mileage error analysis
The average value of five measurements by photoelectric five-wheel is 43.08 km. Taking these data as the accurate mileage, the measurement results are shown in Table 1.
Error analysis for mileage statistics.
From Table 1, we can see that the deviations for the relative odometer method all exceed 5%, and so it is not suitable for accurate mileage statistics. The relative error range of the polyline method is −2.44% to −4.85%, which has a large fluctuation range. This method ignores the curvature of the vehicle’s route and replaces the curve with a straight line. So, the mileage value is always lesser than normal, which can satisfy the general monitor system requirements, but not for monitoring systems with higher accuracy requirements. The fitting method uses quadratic B-spline curve algorithm to fit the trajectory, whose effect is close to the original trajectory, and the curve segment cumulative integral algorithm is used to calculate the mileage. In the five experimental results, taking the average value of five-wheel system result as the standard mileage, the average error of odometer method, polyline method, and fitting method are −6.13%, −3.37%, and 0.16%, respectively. It can be seen that the accuracy of the fitting method is 5.97% higher than the odometer method and 3.12% higher than method, which satisfies the requirement of accurate mileage statistics.
Conclusion
In this article, the non-high-frequency civil satellite data are preprocessed, the trajectory curve is fitted, and the accurate mileage statistical formula is derived. We conclude that;
Aiming at various errors existing in the original GPS data, the original trajectory data were preprocessed: a gravity center method is proposed for the zero drift data, the projection method is used to process the trajectory deviation point, and the key missing data are compensated.
Aiming at the problems existing in the traditional polyline trajectory method, the trajectory curve fitting method based on the quadratic B-spline curve is presented, and the calculation formula of the trajectory mileage is derived. Based on this, the accurate mileage statistics of the non-precision satellite positioning signal are realized, and the mileage statistics in the fleet management is further improved.
According to the new method, an experimental test was carried out, and the relative errors of odometer method, polyline method, and fitting method were compared and analyzed. The analysis results show that the error of the quadratic B-spline fitting method mileage is within 1%, and the average error is reduced by 5.97% compared with the odometer method, and by 3.12% compared with the polyline method, which meets the application requirements for fleet management.
Footnotes
Handling Editor: Daming Zhou
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This study was supported by the Natural Science Foundation of China (grant nos: 61671262, 61871447, and 51806114).
