Vehicle track data analysis method based on direction constraint density clustering algorithm
By introducing the direction-constrained density clustering algorithm, the problem of road directionality blind spots in the existing technology is solved, the accurate clustering of vehicle trajectory data and the separation of two-way roads are achieved, and the accuracy and efficiency of urban road network extraction are improved.
Patent Information
- Application Number
- CN202510868004.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-06-26
AI Technical Summary
Existing technologies ignore road directionality when processing vehicle trajectory data, resulting in the inability to accurately distinguish two-way lanes when dealing with complex areas such as road intersections and turns. Existing clustering algorithms have directional blind spots, which affect the accuracy of road network extraction.
A direction-constrained density clustering algorithm with direction-sensitive distance metric and dynamic adjustment of cluster direction is introduced. Direction similarity is judged by calculating dot product, cluster direction is dynamically updated, it adapts to complex areas, and merges small clusters to achieve separation of two-way roads.
It effectively solves the defects of existing methods in processing the directionality of vehicle trajectory data, can accurately distinguish two-way roads, and improves the accuracy and efficiency of urban road network extraction.
Smart Images

Figure CN120804752A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of urban road network positioning and identification, and particularly relates to a vehicle trajectory data analysis method based on a direction-constrained density clustering algorithm. BACKGROUND
[0002] In the era of continuous development of science and technology, with the continuous development of satellite positioning technology and wireless communication technology, mobile devices with global positioning system (GPS), wireless communication functions and various sensors are widely used in people's daily life, making location-based services (LBS) applications very common, and people can record and obtain location information at any time and anywhere. This has led to the generation of a large amount of trajectory data, which records the movement path of individuals or objects in space. Currently, mobile trajectory data has become the main data source for quickly extracting urban road networks. For the extraction of urban road networks, traditional road data collection methods mainly rely on manual surveying or satellite images, resulting in long road network update cycles and high labor costs. Therefore, how to extract urban road networks from trajectory data has important theoretical significance and practical value.
[0003] Currently, the methods for extracting urban road network information from trajectory data mainly fall into three categories: the first is the rasterization method, which converts complex vector trajectory points into regular raster images, facilitating the application of image processing algorithms and serving as a key bridge connecting original GPS data and road information extraction; the second is the spatial clustering method, which can identify the connection between different road segments based on spatial clustering of trajectory data. However, traditional clustering methods (such as DBSCAN) have certain limitations, especially when considering complex situations such as road directionality, turns, and intersections. The third is the incremental method, which improves extraction efficiency by gradually updating road network information. For example, Zhang Yunfei et al. proposed a multi-temporal incremental road extraction method based on low-frequency trajectory data, mainly addressing the precision and efficiency balance problem faced by traditional methods during road extraction. However, there are still certain limitations in road intersection areas, leading to poor results.
[0004] Currently, the research on urban road network information based on clustering algorithm mostly focuses on the extraction of road intersections, while ignoring the directionality of trajectory data. For example, Tang Luoliang et al. proposed a method for identifying and extracting the structure of urban road intersections based on trajectory big data. This method identifies intersections through clustering of turning point pairs. Chen Weiliang et al. proposed a method for extracting road intersections from low-frequency trajectory data. This method uses heuristic filtering and hierarchical density clustering algorithm to extract intersections, effectively reducing noise and redundant points in low-frequency data, and achieves good results in intersection extraction. Zhang Caili et al. also constructed a navigable road network from taxi trajectory data and proposed a road network generation method based on road intersection information. However, these methods only obtain road intersections through clustering and do not consider the directionality of roads, so there is a directional blind area when processing roads, which cannot accurately distinguish between two-way lanes. SUMMARY
[0005] In order to solve the problems of the prior art, the present application aims to provide a vehicle trajectory data analysis method based on a direction-constrained density clustering algorithm. The present application introduces a direction-sensitive distance metric to solve the problem of strong directionality and complex traffic flow in road traffic data. By dynamically adjusting the direction of the cluster, the clustering algorithm can better adapt to complex areas such as road turns and intersections, thereby effectively separating two-way roads and overcoming the shortcomings of existing methods in handling the directionality of vehicle trajectory data.
[0006] To achieve the above purpose, the technical scheme adopted by the present application is as follows:
[0007] A vehicle trajectory data analysis method based on a direction-constrained density clustering algorithm, which is implemented based on the following steps:
[0008] S1. Data preparation and processing: coordinate conversion and cleaning of vehicle trajectory data, smoothing using Kalman filtering, and calculation of cosine value of trajectory points;
[0009] S2. Construction of spatial index: construction of tree data structure KDTree for fast query of neighbors of each point within a given radius eps;
[0010] S3. Direction filtering: in the queried neighbors, the dot product of the directions of each point is calculated to determine whether the direction similarity condition is met, i.e. the dot product is greater than or equal to the cosine threshold, thereby obtaining valid neighbors;
[0011] S4. Cluster expansion: starting from unvisited points, valid neighbors that meet spatial and directional conditions are gradually expanded into the current cluster, and the average direction of the cluster is dynamically updated;
[0012] S5. Preliminary clustering and small cluster merging: after forming a preliminary plurality of clusters, for small clusters with fewer points, use the points in large clusters to "vote" on the classification of these small cluster points, and realize the merging of small clusters;
[0013] S6. Finally output the cluster label.
[0014] Further, step S1 specifically includes the following steps:
[0015] S1-1. The coordinate system conversion formula of the vehicle trajectory data is as follows:
[0016] x = lon-105.0, y = lat-35.0
[0017]
[0018]
[0019] wherein, then:
[0020]
[0021] In the formula, the value of the major semi-axis a is 6378245.0, the value of the flattening e is 0.0066934, x represents the deviation in longitude from the China Geodetic Datum, y represents the deviation in latitude from the China Geodetic Datum, lon represents the longitude in the current GCJ-02 coordinate system, lat represents the latitude in the current GCJ-02 coordinate system, m is the parameter of the ellipsoid correction, Δlon represents the original deviation value of the longitude without ellipsoid correction, Δlat represents the original deviation value of the latitude without ellipsoid correction, lon wgs represents the longitude of the wgs84 coordinate system obtained after conversion, and lat wgs represents the latitude of the wgs84 coordinate system obtained after conversion.
[0022] S1-2. Kalman filtering is used to suppress noise by establishing a state space model. The vehicle state vector is defined as:
[0023] Xk = [longitude, latitude, eastward velocity, northward velocity] T ;
[0024] The state transition matrix F is used to predict the state at the next time, and the observation matrix H is used to fuse the measured coordinate values for iterative correction.
[0025] The state transition matrix F is represented as:
[0026]
[0027] The observation matrix H is represented as:
[0028]
[0029] Further, step S3 specifically includes the following:
[0030] Direction judgment: average direction vector v of current cluster cluster is:
[0031] v cluster = (cosφ, sinφ),
[0032] wherein φ is the angle of the current cluster, and if the current cluster has only one point, φ is equal to the heading angle of the point, otherwise φ is the resultant angle;
[0033] Direction vector v of neighbor point neighbor is:
[0034] v neighbor = (cosθ, sinθ);
[0035] wherein θ represents the heading angle of the current point.
[0036] Dot product calculation:
[0037] v cluster · v neighbor = cosφcosθ + sinφsinθ = cos(φ-θ);
[0038] Comparison with angle threshold value α:
[0039] cos(φ-θ) ≥ cosα;
[0040] The dot product value directly reflects the direction similarity: the closer the value is to 1, the more consistent the directions are; when the dot product value is greater than the cosine value of the threshold value, it means that the direction difference between the two points does not exceed the threshold value, and the directions are similar.
[0041] Further, step S4 specifically includes:
[0042] The accumulated direction component is:
[0043] sum_x = ∑cosθ i , sum_y = ∑sinθ i ;
[0044] wherein sum_x represents the sum of all points in the cluster in the x-axis direction, sum_y represents the sum of all points in the cluster in the y-axis direction, and θ i represents the points in the cluster.
[0045] The resultant angle φ is calculated as:
[0046] φ = arctan2(sum_y, sum_x);
[0047] Updating cluster direction v cluster For:
[0048] v cluster = (cos phi, sin phi).
[0049] The present application has the beneficial effects of:
[0050] 1. The vehicle trajectory data analysis method disclosed in the present application introduces a heading angle constraint mechanism in the core point determination and density expansion stage of the direction-constrained density clustering algorithm, and dynamically updates the direction of the cluster to adapt to complex areas such as turns and intersections; For the measurement of directionality, the algorithm uses the dot product of the sine and cosine values of the point to calculate the direction, and if the dot product is greater than or equal to the cosine value of the distance threshold, it means that the direction of the neighbor point is closer to the main direction of the current cluster. In the post-processing, for small clusters with fewer points, use the points in the large cluster to "vote" and classify these noise points, realize the merging of small clusters, and finally output the clustering label.
[0051] 2. The present application can identify vehicle trajectory data of different directions by adding directionality judgment, so as to extract roads of different directions.
[0052] 3. The present application solves the problem of strong directionality and complex traffic flow in road traffic data by introducing a direction-sensitive distance measurement; by dynamically adjusting the direction of the cluster, the clustering algorithm can better adapt to complex areas such as road turns and intersections, thereby effectively separating bidirectional roads. Not only enriches the application scenarios of DBSCAN algorithm, but also provides a new technical path for the rapid extraction of urban road network.
[0053] 4. The dynamic updating of the cluster direction of the present application is used to comprehensively reflect the overall trend of all points in the cluster in real time, and the average direction is calculated by accumulating the sine and cosine components of each point, so that the latest direction representing the entire cluster is used as a reference when judging whether the new neighbor point meets the direction requirement, thereby ensuring that the clustering process not only spatially close, but also directionally consistent. BRIEF DESCRIPTION OF DRAWINGS
[0054] Figure 1 The present application is a flowchart of the DBSCAN clustering algorithm with directionality constraint;
[0055] Figure 2 The present application is a road network map before clustering in the experimental area in the simulation experiment;
[0056] Figure 3 The present application is a clustering effect diagram after removing noise points in the simulation experiment. DETAILED DESCRIPTION
[0057] The principles and features of the present application will be described below in conjunction with the accompanying drawings, which are provided by way of illustration only, but are not intended to limit the scope of use of the present application.
[0058] DBSCAN is a density-based clustering algorithm, which forms clusters by checking the density around data points, can handle noise, and does not need to specify the number of clusters in advance. Although it can effectively identify the cluster structure of any shape in spatial clustering, the density connection criterion based on Euclidean distance has a direction blind area. In the urban road network scene, the topology structure such as bidirectional lane and parallel viaduct will form trajectory clusters with opposite directions in spatial position, and the clustering depending on spatial distance will lead to the mismerger of reverse lanes, which seriously affects the vectorization accuracy of road network.
[0059] The present application proposes a vehicle trajectory data analysis method based on a direction-constrained density clustering algorithm, which introduces a heading angle constraint mechanism in the core point determination and density expansion stage of the direction-constrained density clustering algorithm, and dynamically updates the direction of the cluster to adapt to complex areas such as turns and intersections. For the measurement of directionality, the present algorithm uses the dot product of the sine and cosine values of the point to calculate the dot product of the direction, and if the dot product is greater than or equal to the cosine value of the distance threshold, it means that the direction of the neighbor point is close to the main direction of the current cluster. In the post-processing, for small clusters with fewer points, the points in the large cluster are used to "vote" and classify these noise points, realizing the merging of small clusters, and finally outputting the clustering label. Figure 1 The flow chart of the DBSCAN clustering algorithm with directionality constraint introduced by the present application.
[0060] The vehicle trajectory data analysis method based on the direction-constrained density clustering algorithm proposed by the present application has the following specific implementation steps:
[0061] Step S1. Data preparation and processing: coordinate conversion and cleaning of vehicle trajectory data, and smoothing using Kalman filter, and then calculating the cosine value of the trajectory point;
[0062] S1-1. The coordinate system conversion formula of the vehicle trajectory data is as follows:
[0063] x=lon-105.0,y=lat-35.0
[0064]
[0065] Wherein, Then:
[0066]
[0067] In the formula, the value of the major axis a is 6378245.0, the value of the flattening e is 0.0066934, x represents the deviation in longitude from the China Geodetic Datum, y represents the deviation in latitude from the China Geodetic Datum, lon represents the current longitude in the GCJ-02 coordinate system, lat represents the current latitude in the GCJ-02 coordinate system, m is a parameter of the ellipsoid correction, Δlon represents the original deviation value of the longitude without ellipsoid correction, Δlat represents the original deviation value of the latitude without ellipsoid correction, lon wgs represents the longitude of the wgs84 coordinate system obtained through conversion, and lat wgs represents the latitude of the wgs84 coordinate system obtained through conversion.
[0068] S1-2. Kalman filtering realizes noise suppression by establishing a state space model, and the vehicle state vector is defined as:
[0069] Xk=[longitude, latitude, eastward velocity, northward velocity] T ,
[0070] The state transition matrix F is utilized:
[0071]
[0072] The next time state is predicted, and then the measured coordinate value is fused through the observation matrix H for iterative correction; the observation matrix H is:
[0073]
[0074] Step S2. Constructing a spatial index: constructing a tree data structure KDTree for quickly querying the neighbors of each point within a given radius eps;
[0075] Step S3. Directional filtering: in the queried neighbors, whether the directional similarity condition is met is judged by calculating the dot product of the directions of the points, that is, the dot product is greater than or equal to the cosine threshold, so as to obtain effective neighbors;
[0076] Direction judgment: the average direction vector v cluster of the current cluster is:
[0077] v cluster =(cosφ, sinφ);
[0078] In the formula, φ is the angle of the current cluster, and if the current cluster has only one point, φ is equal to the heading angle of the point, otherwise it is the synthesized angle;
[0079] The direction vector v neighbor of the neighbor point is:
[0080] v neighbor =(cosθ, sinθ);
[0081] where θ denotes the heading angle of the current point.
[0082] Dot product calculation:
[0083] v cluster ·v neighbor = cosφcosθ + sinφsinθ = cos(φ-θ);
[0084] Comparison with angle threshold α:
[0085] cos(φ-θ) ≥ cosα;
[0086] Dot product value directly reflects the direction similarity: the closer the value is to 1, the more consistent the directions are; when the dot product value is greater than the cosine value of the threshold, it means that the direction difference between the two points does not exceed the threshold, and the directions are similar.
[0087] Step S4. Cluster expansion: starting from the unvisited points, gradually expand the valid neighbors that meet the space and direction conditions into the current cluster, and dynamically update the average direction of the cluster;
[0088] The accumulated direction component is:
[0089] sum_x = ∑cosθ i ,sum_y = ∑sinθ i ;
[0090] where sum_x denotes the sum of all points in the cluster in the x-axis direction, sum_y denotes the sum of all points in the cluster in the y-axis direction, and θ i denotes the points in the cluster.
[0091] The calculated composite angle φ is:
[0092] φ = arctan2(sum_y, sum_x);
[0093] The updated cluster direction v cluster is:
[0094] v cluster = (cosφ, sinφ);
[0095] Step S5. Preliminary clustering and small cluster merging: after forming the preliminary multiple clusters, for small clusters with fewer points, use the points in large clusters to "vote" and classify these small cluster points, realizing the merging of small clusters.
[0096] Step S6. Finally output the cluster label.
[0097] Simulation experiment:
[0098] For example Figure 2 and Figure 3As shown, the present application selects four areas in Futian District of Shenzhen to perform experiments according to the vehicle trajectory data analysis method. Figure 2 The road network diagram before clustering is shown in FIG. Figure 3 The clustering effect after removing noise points is shown in FIG.
[0099] In summary, the present application introduces a direction-sensitive distance measure to solve the problem of strong directionality and complex traffic flow in road traffic data; by dynamically adjusting the direction of the cluster, the clustering algorithm can better adapt to complex areas such as road turns and intersections, thereby effectively separating bidirectional roads and overcoming the defects of existing methods in handling the directionality of vehicle trajectory data.
[0100] Obviously, the above-described embodiments are only some of the embodiments of the present application, not all the embodiments, and the preferred embodiments of the present application are given in the drawings, but do not limit the patent scope of the present application. The present application can be implemented in many different forms, and conversely, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions recorded in the foregoing specific embodiments, or equivalently replace some of the technical features. Any equivalent structure made by using the content of the specification and drawings, directly or indirectly applied to other related technical fields, is also within the scope of the patent protection of the present application.
Claims
1. A vehicle trajectory data analysis method based on a direction-constrained density clustering algorithm, characterized by: The method is implemented based on the following steps: S1. Data preparation and processing: Perform coordinate conversion and cleaning on the vehicle trajectory data, smooth it using a Kalman filter, and then calculate the cosine value of the trajectory points. S2. Build a spatial index: Build a tree data structure KDTree to quickly query the neighbors of each point within a given radius eps; S3. Directional filtering: Among the neighbors found, the dot product of each point's direction is calculated to determine whether the direction similarity condition is met. That is, the dot product must be greater than or equal to the cosine threshold, thereby obtaining valid neighbors. S4. Cluster expansion: Starting from unvisited points, gradually expand the valid neighbors that meet the spatial and directional conditions into the current cluster, and dynamically update the average direction of the cluster; S5. Preliminary clustering and merging of small clusters: After forming multiple preliminary clusters, for small clusters with fewer points, use the points in the larger cluster to "vote" and classify these small clusters, thereby merging the small clusters. S6. Finally, output the cluster label.
2. The vehicle trajectory data analysis method based on the direction-constrained density clustering algorithm according to claim 1 is characterized in that: Step S1 specifically includes the following steps: S1-1. The coordinate system conversion formula for vehicle trajectory data is as follows: x = lon - 105.0, y = lat - 35.0 in, Then we have: Wherein, the value of the major axis a is 6378245.0, the value of the flattening e is 0.0066934, x represents the deviation from the Chinese geodetic origin in longitude, y represents the deviation from the Chinese geodetic origin in latitude, lon represents the longitude in the current GCJ-02 coordinate system, lat represents the latitude in the current GCJ-02 coordinate system, m is the parameter of the ellipsoid correction, Δlon represents the original longitude offset value without ellipsoid correction, Δlat represents the original latitude offset value without ellipsoid correction, lon wgs Indicates the longitude of the wgs84 coordinate system obtained after conversion, lat wgs Indicates the latitude of the WGS84 coordinate system obtained after conversion; S1-2. Kalman filtering achieves noise suppression by establishing a state space model. The vehicle state vector is defined as: Xk = [longitude, latitude, easting speed, northing speed] T ; The state transfer matrix F is used to predict the state at the next moment, and then the measured coordinate values are integrated through the observation matrix H for iterative correction; The state transfer matrix F is expressed as: The observation matrix H is expressed as:
3. The vehicle trajectory data analysis method based on the direction-constrained density clustering algorithm according to claim 2 is characterized in that: Step S3 specifically Includes the following: Direction judgment: the average direction vector v of the current cluster cluster for: in cluster =(cosφ,sinφ); Where φ is the angle of the current cluster. If the current cluster has only one point, then φ is equal to the heading angle of that point; otherwise, it is the composite angle. The direction vector v of the neighbor point neighbor for: v neighbor =(cosθ,sinθ); Where θ represents the heading angle of the current point; Dot product calculation: v cluster ·v neighbor =cosφcosθ+sinφsinθ=cos(φ-θ), Compared with the angle threshold α: cos(φ-θ)≥cosα; The dot product value directly reflects the directional similarity: the closer the value is to 1, the more consistent the directions are; when the dot product value is greater than the cosine value of the threshold, it means that the directional difference between the two points does not exceed the threshold and the directions are similar.
4. The vehicle trajectory data analysis method based on the direction-constrained density clustering algorithm according to claim 3 is characterized in that: Step S4 specifically includes: The accumulated direction component is: sum_x=∑cosθ i ,sum_y=∑sinθ i ; In the formula, sum_x represents the sum of all points in the cluster in the x-axis direction, sum_y represents the sum of all points in the cluster in the y-axis direction, θ i represents the points within the cluster; Calculate the resultant angle φ as: φ=arctan2(sum_y,sum_x); Update cluster direction v cluster for: in cluster = (cosφ, sinφ).
Citation Information
Patent Citations
A fast updating method of road network based on trajectory adaptive clustering
CN109241069A
Vehicle track clustering method based on road network sensitive characteristics
CN113611115A