A vehicle trajectory data analysis method based on a direction-constrained density clustering algorithm
By introducing a directional constraint density clustering algorithm, the problem of ineffective handling of road directionality in existing technologies is solved, enabling accurate separation of vehicle trajectory data and road network extraction, thereby improving the extraction accuracy and continuity of urban road networks.
Patent Information
- Application Number
- CN202510868004.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2045-06-26
AI Technical Summary
Existing technologies fail to effectively consider road directionality when processing vehicle trajectory data, resulting in an inability to accurately distinguish between two-way lanes when dealing with complex areas such as road intersections and turns, thus affecting the accuracy of road network extraction.
A direction-sensitive distance metric and a direction-constrained density clustering algorithm that dynamically adjusts cluster orientation are introduced. The algorithm determines directional similarity by calculating dot products, dynamically updates cluster orientation, adapts to complex regions, and achieves separation of bidirectional roads.
It effectively solves the shortcomings of existing methods in processing the directionality of vehicle trajectory data, can better adapt to complex areas such as road turns and intersections, achieves accurate separation of two-way roads, and improves the accuracy and continuity of road network extraction.
Smart Images

Figure CN120804752B_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 effectively reduces 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 using 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, resulting in a directional blind area when processing roads and an inability to accurately distinguish between two-way lanes. SUMMARY
[0005] To solve the problems of the prior art, the present application provides a vehicle trajectory data analysis method based on a direction-constrained density clustering algorithm. The present application introduces a direction-sensitive distance metric to address the strong directionality and complex traffic flow of 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, effectively separating two-way roads and overcoming the deficiencies of existing methods in handling the directionality of vehicle trajectory data.
[0006] To achieve the above-mentioned purposes, 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 values of trajectory points;
[0009] S2. Construction of spatial index: construction of a tree-shaped data structure KDTree for fast querying of neighbors within a given radius eps for each point;
[0010] S3. Directional filtering: among the queried neighbors, determine whether the direction similarity condition is met by calculating the dot product of each point's direction, i.e., the dot product is greater than or equal to the cosine threshold, to obtain valid neighbors;
[0011] S4. Cluster expansion: starting from unvisited points, gradually expand valid neighbors that meet spatial and directional conditions into the current cluster, and dynamically update the average direction of the cluster;
[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 meant neither to limit nor define the scope of the application.
[0058] DBSCAN is a density-based clustering algorithm that forms clusters by examining the density around a data point, can handle noise, and does not need to specify the number of clusters in advance. Although it can effectively identify arbitrary shape cluster structures in spatial clustering, the density connection criterion based on Euclidean distance has a direction blind area. In the urban road network scene, topological structures such as two-way lanes and parallel viaducts will form trajectory clusters with opposite directions in spatially adjacent positions. Clustering purely relying on spatial distance will lead to the mismerger of reverse lanes, seriously affecting the accuracy of road network vectorization.
[0059] The present application proposes a vehicle trajectory data analysis method based on a direction-constrained density clustering algorithm. The method 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 points to calculate the dot product of the direction. 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, 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 flowchart 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 filtering, 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 method for analyzing vehicle trajectory data based on a directional constraint density clustering algorithm, characterized in that: This method is implemented based on the following steps: S1. Data preparation and processing: Perform coordinate transformation and cleaning on the vehicle trajectory data, smooth it using Kalman filtering, and then calculate the cosine value of the trajectory points; S2. Constructing a spatial index: Constructing a tree data structure KDTree for quickly querying the neighbors of each point within a given radius eps; S3. Directional filtering: Among the neighbors found, the dot product of the directions of each point is calculated to determine whether the directional similarity condition is met, that is, the dot product is greater than or equal to the cosine threshold, so as to obtain effective neighbors; S4. Cluster Expansion: Starting from unvisited points, expand the effective neighbors that meet the spatial and directional conditions to the current cluster step by step, and dynamically update the average orientation of the cluster; S5. Preliminary clustering and small cluster merging: After forming multiple preliminary clusters, for small clusters with fewer points, the points in the larger clusters are used to "vote" and classify these small clusters, thereby merging the small clusters; S6. Finally, output the cluster labels.
2. The vehicle trajectory data analysis method based on the orientation-constrained density clustering algorithm according to claim 1, characterized in that: Step S1 specifically includes the following steps: S1-1. The coordinate system transformation formula for vehicle trajectory data is as follows: x = lon - 105.0, y = lat - 35.0 in, Then we have: In the formula, the value of the semi-major axis 'a' is 6378245.0, the value of the flattening 'e' is 0.0066934, 'x' represents the deviation from the China Geodetic Origin in longitude, 'y' represents the deviation from the China 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 ellipsoidal correction parameter, 'Δlon' represents the original longitude offset without ellipsoidal correction, and 'Δlat' represents the original latitude offset without ellipsoidal correction. wgs This represents the longitude in the transformed WGS84 coordinate system, lat wgs This represents the latitude in the transformed WGS84 coordinate system; S1-2. Kalman filtering achieves noise suppression by establishing a state-space model. The vehicle state vector is defined as: Xk = [Longitude, Latitude, Eastward velocity, Northward velocity] T ; The state at the next time step is predicted using the state transition matrix F, and then iteratively corrected by fusing the measured coordinate values with the observation matrix H. The state transition matrix F is expressed as: The observation matrix H is represented as:
3. The vehicle trajectory data analysis method based on the orientation-constrained density clustering algorithm according to claim 2, characterized in that: Step S3 details Includes the following: Direction determination: the average direction vector v of the current cluster cluster for: in cluster =(cosφ,sinφ); In the formula, φ 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 resultant angle. The direction vector v of the neighboring point neighbor for: v neighbor =(cosθ,sinθ); In the formula, θ 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 similarity of directions: the closer the value is to 1, the more consistent the directions are; when the dot product value is greater than the cosine of the threshold, it means that the difference in direction between the two points does not exceed the threshold, and the directions are similar.
4. The vehicle trajectory data analysis method based on the orientation-constrained density clustering algorithm according to claim 3, characterized in that: Step S4 specifically includes: The accumulated directional components are: sum_x=∑cosθ i ,sum_y=∑sinθ i ; In the formula, sum_x represents the sum of all points in the cluster along the x-axis, sum_y represents the sum of all points in the cluster along the y-axis, and θ i Represents a point within a cluster; The resultant angle φ is calculated as follows: φ = 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