A clustering analysis method and system for trajectory data in the field of spatial data governance

Through GeoHash coding and meshing, combined with the KD-Tree structure, the DBSCAN algorithm is improved, which solves the problem of efficient storage and computing efficiency of large-scale urban GPS trajectory data, and significantly improves the efficiency of cluster analysis of urban GPS trajectory data.

CN118193653BActive Publication Date: 2024-09-06TIANJIN URBAN PLANNING & DESIGN INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410591681.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-14
Publication Date
2024-09-06
Estimated Expiration
2044-05-14

AI Technical Summary

Technical Problem

In urban environments, the traditional DBSCAN algorithm has problems with high memory and I/O consumption when processing large-scale urban GPS trajectory data, resulting in limited computing and storage resources and low efficiency.

Method used

GeoHash is used to convert the latitude and longitude space coding, and the data is divided into grids. The KD-Tree structure is used to organize the neighborhood grid data, the search range is determined through distance comparison, and nearest neighbor search is performed to complete clustering.

Benefits of technology

It effectively improves the efficiency of data storage and algorithm operation, significantly reduces the running time, and improves the efficiency of cluster analysis of urban GPS trajectory data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118193653B
    Figure CN118193653B
Patent Text Reader

Abstract

The present invention proposes a clustering analysis method and system for trajectory data in the field of spatial data governance. For the GPS trajectory point database, GeoHash is used to convert the longitude and latitude space code for storage; according to the longitude and latitude of the GPS trajectory point, the data space is divided into grids, and the four vertices of the grid are converted and stored by GeoHash space conversion; the GPS trajectory point data in each grid is organized in a KD-Tree structure and Geohash conversion is performed for storage; when performing the nearest neighbor search of clustering, the distance between the GPS trajectory point data and the four sides of the grid to which it belongs is compared with the search radius respectively, and it is determined whether to add the neighborhood grid of the grid to the search range according to the comparison result; clustering is completed. The present invention improves the traditional DBSCAN density accumulation algorithm, which can effectively improve the efficiency of urban GPS trajectory data storage and algorithm operation, and serve the subsequent urban planning analysis and other fields.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of urban planning information technology, and in particular relates to a clustering analysis method and system for trajectory data in the field of spatial data management. Background Art

[0002] In urban environments, a large amount of GPS trajectory data is generated and accumulated in real time. Therefore, cluster analysis of GPS trajectory data is very important in the field of urban planning information technology. In the prior art, the DBSCAN algorithm is often used to cluster urban GPS trajectory data. DBSCAN is a classic unsupervised clustering method based on density clustering. Its excellent characteristics are widely used in the research field of spatial information. However, the use of the traditional DBSCAN algorithm for urban GPS trajectory data at a large sample set scale is prone to the following problems:

[0003] Due to the large spatial distribution scale of urban GPS trajectory data elements, large data volume, special data distribution, and high accuracy of GPS longitude and latitude data; using the DBSCAN algorithm to directly operate on the entire GPS trajectory data set, the memory space and I / O consumption required by the algorithm are considerable. In scenarios where computing and storage resources are limited and the data volume is very large, the efficiency of the DBSCAN algorithm will be greatly affected. Summary of the invention

[0004] The present invention proposes a clustering analysis method and system for trajectory data in the field of spatial data management, which improves the traditional DBSCAN density accumulation algorithm, can effectively improve the efficiency of urban GPS trajectory data storage and algorithm operation, and serve subsequent urban planning analysis and other fields.

[0005] To achieve the above object, the technical solution of the present invention is achieved as follows:

[0006] A cluster analysis method for trajectory data in the field of spatial data governance, comprising:

[0007] S1. For the GPS track point database, use GeoHash to convert the longitude and latitude spatial encoding for storage;

[0008] S2. Divide the data space into grids according to the longitude and latitude of the GPS track points, and perform GeoHash spatial conversion and storage on the four vertices of the grid;

[0009] S3. When performing the nearest neighbor search of clusters, the GPS track point data of the grid where the cluster center point is located and its surrounding neighborhood grids are organized in a KD-Tree structure; the distances between the cluster center point and the four sides of the grid to which it belongs are compared with the search radius respectively, and whether to add the neighborhood grids of the grid to which it is located to the search range is determined according to the comparison results;

[0010] S4. Perform nearest neighbor search according to the determined search range to complete clustering.

[0011] Further, step S2 includes:

[0012] S201, performing grid division according to the maximum and minimum longitude and latitude in the GPS track point data set, and the set grid length and width;

[0013] S202, sequentially encode the grids, and calculate the grid code according to the latitude and longitude coordinates of the GPS track point data;

[0014] S203, dividing all GPS track point data into corresponding grids for storage, and performing Geohash conversion on the four vertices of the grid for storage.

[0015] Furthermore, step S3 specifically includes:

[0016] If the distance between the GPS track point data and the edge of the grid to which it belongs is less than the search radius, the neighborhood grid corresponding to the edge will be included in the search range, otherwise it will not be included;

[0017] If the distances between the GPS track point data and the two adjacent edges of the grid to which it belongs are both smaller than the search radius, the neighborhood grid corresponding to the angle between the two adjacent edges will be included in the search range, otherwise it will not be included.

[0018] Furthermore, the distance is calculated by GeoHash.

[0019] On the other hand, the present invention also proposes a clustering analysis system for trajectory data in the field of spatial data management, comprising:

[0020] Database conversion module: For the GPS track point database, GeoHash is used to convert the longitude and latitude spatial coding for storage;

[0021] Grid division module: divides the data space into grids according to the longitude and latitude of the GPS track points, and performs GeoHash spatial conversion and storage on the four vertices of the grid;

[0022] Comparison module: When performing the nearest neighbor search of clusters, the GPS track point data of the grid where the cluster center point is located and its surrounding neighborhood grids are organized in a KD-Tree structure; the distance between the cluster center point and the four sides of the grid to which it belongs is compared with the search radius respectively, and according to the comparison results, it is determined whether to add the neighborhood grids of the grid to the search range;

[0023] Clustering module: Perform nearest neighbor search based on the determined search range to complete clustering.

[0024] Furthermore, the meshing module includes:

[0025] Division unit: Grid division is performed according to the maximum and minimum longitude and latitude in the GPS track point data set, as well as the set grid length and width;

[0026] Coding unit: sequentially encodes the grids and calculates the grid code according to the latitude and longitude coordinates of the GPS track point data;

[0027] Storage unit: All GPS track point data are divided into corresponding grids for storage, and the four vertices of the grid are Geohash converted and stored.

[0028] Furthermore, the comparison module includes:

[0029] The first comparison unit: if the distance between the GPS track point data and the edge of the grid to which it belongs is less than the search radius, the neighborhood grid corresponding to the edge is included in the search range, otherwise it is not included;

[0030] Second comparison unit: if the distances between the GPS track point data and the two adjacent sides of the grid to which it belongs are both smaller than the search radius, the neighborhood grid corresponding to the angle between the two adjacent sides is included in the search range, otherwise it is not included.

[0031] Furthermore, in the comparison module, the distance is calculated by GeoHash.

[0032] Compared with the prior art, the present invention has the following beneficial effects:

[0033] Aiming at the characteristics of large spatial distribution scale, large data volume and special data distribution of existing urban GPS trajectory point data elements, the present invention improves the traditional DBSCAN density accumulation algorithm, and can cluster urban GPS trajectories generated by terminals such as taxis, buses, and shared bicycles. Through data spatial coding preprocessing and algorithm improvement, the data storage and algorithm operation efficiency are effectively improved to serve subsequent urban planning analysis and other fields. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 is a schematic diagram of a flow chart of an embodiment of the present invention;

[0035] Figure 2 is a schematic diagram of grid division and search in an embodiment of the present invention;

[0036] Figure 3 1 is a graph showing a comparison of the running time of the present invention and DBSCAN and a percentage improvement in running efficiency in an embodiment of the present invention;

[0037] Figure 4It is a comparison of the running time of the present invention and DBSCAN (kd-tree) in the embodiment of the present invention and a graph showing the percentage improvement of the running efficiency. DETAILED DESCRIPTION

[0038] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0039] In order to make the purpose and features of the present invention more obvious and understandable, the present invention is further described below in conjunction with the accompanying drawings and specific embodiments.

[0040] The specific steps of the method of the present invention in this embodiment are as follows Figure 1 As shown, the following steps are included:

[0041] S1. For the database of trajectory data, specifically the trajectory GPS point database, GeoHash is used to convert the longitude and latitude spatial encoding for storage, which serves as the original data for storage and similarity calculation.

[0042] The original longitude and latitude values ​​in the data set are converted from decimal to binary storage through GeoHash encoding based on the median accuracy, which significantly improves the subsequent storage and computing efficiency.

[0043] S2. Divide the data space into grid units. It is necessary to calculate the maximum and minimum values ​​of the data space of each dimension (longitude, latitude), divide the grid according to the research granularity, and record the four vertices of each grid for GeoHash space conversion and storage for fast distance judgment. After division, the grid contains three elements: ID, Neighbor, and Data. ID is the grid number, Neighbor is the eight-neighborhood set of the grid (upper, lower, left, right, upper left, lower left, upper right, and lower right adjacent grids), and Data is the data point in the grid (i.e., the trajectory GPS point). Each data point in the grid is organized in a KD-Tree structure to improve search efficiency.

[0044] The grid division method is as follows:

[0045] definition For the length of each grid, The width of each grid; is the grid, i is the horizontal coordinate of the grid, and j is the vertical coordinate of the grid; is the grid number corresponding to the grid.

[0046] For data points The grid number to which it belongs.

[0047] S2.1, based on the maximum and minimum longitude and latitude in the data set, Perform grid division. Obtain the X and Y values of the scale to be calculated.

[0048] ; where is the maximum longitude, is the minimum longitude;

[0049] ; where is the maximum latitude, is the minimum latitude;

[0050] S2.2. Encode the grid, and for all data points , calculate their respective grid numbers ;

[0051] ; where is the longitude of the data point , is the latitude of the data point ;

[0052] S2.3. Calculate the grid number corresponding to the grid, and divide the data points into the corresponding grids according to their respective grid numbers; specifically including:

[0053] When for the grid i < X and j < Y, assign the grid number corresponding to the grid as i + j * X;

[0054] According to the grid numbers of the data points calculated in step S2.2, divide each data point into the grid with the corresponding grid number;

[0055] Thus, the grid division and the collection of each data point position are completed.

[0056] At the same time, according to the above grid division, obtain the coordinates of the four vertices of each grid and perform Geohash conversion, and store the converted codes.

[0057] S3. Based on the grid division result, perform spatial clustering through an improved proximity search algorithm;

[0058] First, organize the GPS trajectory point data of the grid where the clustering center point is located and its surrounding neighborhood grids in a KD-Tree structure; the neighborhood grids refer to the eight-neighborhood grids in the Neighbor parameter of the grid. If the grid is located at the edge, the number of neighborhood grids is less than 8.

[0059] Define Eps as the clustering center point (for example, data point P t) is the search radius for the nearest neighbor search. If the set of all neighboring points in the neighborhood of the search radius exceeds a predefined parameter MinPts, then P t The points belong to the same cluster as its neighboring points. If it is less than MinPts, it is considered a point of another cluster or a noise point.

[0060] If the traditional DBSCAN algorithm process is used, the data point P t When performing the nearest neighbor search, the distances of all data points in the entire data set are calculated, and the set of all neighboring points in the neighborhood of the search radius is selected according to the distances. After the grid is divided, the distances between the center point and the four partition boundaries (i.e., the distances to the four sides of the grid) are compared with the size of Eps to determine whether the neighborhood grid is searched. This changes the previous query mode of traversing the entire data set, effectively reducing the search space.

[0061] In this embodiment, since all data points in the same grid are organized in a KD-Tree structure, KD-Tree is a data structure suitable for low-dimensional spatial data search. Therefore, when calculating the distance, the distance calculation is performed by GeoHash, rather than the traditional DBSCAN using Euclidean distance. The distance calculation of the present invention can greatly increase the calculation efficiency.

[0062] like Figure 2 As shown, for the data point P t , when the nearest neighbor search is performed, it is consistent with the grid The distances of the four sides are , , , ;

[0063] if , then the grid below the edge corresponds to ( Figure 2 (not shown) and its internal data points are added to the search range;

[0064] if , then the grid above the edge corresponds to and its internal data points are added to the search scope;

[0065] if , then the grid on the left side corresponding to this edge ( Figure 2 (not shown) and its internal data points are added to the search range;

[0066] if , then the grid on the right side corresponding to this edge and its internal data points are added to the search scope;

[0067] if and , then the upper right grid corresponding to the angle between the two sides is And its internal data points are also included in the search scope;

[0068] if and , then the grid at the lower left corresponding to the angle between the two sides ( Figure 2 (not shown) and its internal data points are also included in the search range;

[0069] if and , then the grid at the lower right corner corresponding to the angle between the two sides is ( Figure 2 (not shown) and its internal data points are also included in the search range;

[0070] if and , then the upper left grid corresponding to the angle between the two sides ( Figure 2 The data points inside the image (not shown) are also included in the search range.

[0071] like Figure 2 The data point P shown t The distances to the four edges are all greater than the search radius Eps (i.e., P in the figure). t Therefore, according to the above judgment rules, there is no need to add other grids, and only the distance to the data points in this grid can be calculated through GeoHash.

[0072] for Figure 2 Another data point P in the cluster as the center point q As shown in the figure, its search radius has exceeded the grid it belongs to. The distance between the left side and the bottom side, according to the above judgment rules, data point P q When performing a nearest neighbor search, the table below , lower left table , Left grid The search range needs to be added. At this time, the data point P needs to be calculated through GeoHash. q With Grid The distance between the data points in the grid and the data points in the other grids are not included in the calculation. Therefore, the calculation does not include redundant search grids, and the nearest neighbor search efficiency is improved.

[0073] S4. Perform nearest neighbor search according to the search range determined in the above steps, calculate the distance, and complete clustering. Then, perform secondary clustering on the clustering results based on the clustering effect and research scale.

[0074] The above method improves the measurement accuracy, reduces the time consumption compared to the traditional DBSCAN algorithm, and can perform multiple clustering according to the research scale. The improved method can well handle the trajectory GPS points at the urban scale and has good robustness and adaptability.

[0075] The cluster analysis method proposed in the present invention is tested for performance. Since both the present invention and the traditional DBSCAN algorithm belong to density clustering, the clustering results of the two are the same under the same parameters, so the focus is on the experimental evaluation of the algorithm operation efficiency. The experimental test data all select the GPS taxi pick-up and drop-off points in a certain city as the basic data. The taxi pick-up points are divided into 24 time periods in a day, and the data are sampled by stratified sampling method. The running time is sampled multiple times and the average is taken. Due to the instability of the experimental hardware, all experimental data are recorded by running the program 10 times and taking the average.

[0076] like Figure 3 As shown in the figure, when the parameters are fixed (radius=1000m, Minpts=10), as the number of spatial data points increases, the difference in running time between the traditional DBSCAN algorithm and the present invention and the percentage of running time saved continue to expand. When there are 15,000 data points, the running efficiency of the PK-DBSCAN algorithm is nearly 90% higher than that of the DBSCAN algorithm.

[0077] The performance of the present invention and the DBSCAN density clustering algorithm using KD-Tree are evaluated. When the parameters are fixed (radius=1000m, MinPts=10), Figure 4 As shown, the operating efficiency has been improved by nearly 30%.

[0078] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A cluster analysis method for trajectory data in the field of spatial data governance, characterized in that: include: S1. For the GPS track point database, use GeoHash to convert the longitude and latitude spatial encoding for storage; convert the original longitude and latitude values ​​from decimal to binary storage through GeoHash encoding based on the median accuracy; S2. Divide the data space into grids according to the longitude and latitude of the GPS track points, and perform GeoHash spatial conversion and storage on the four vertices of the grid; S3. When performing the nearest neighbor search of clustering, the GPS track point data of the grid where the cluster center point is located and its surrounding neighborhood grids are organized in a KD-Tree structure; The distances between the cluster center and the four sides of the grid to which it belongs are compared with the search radius, and whether to add the neighboring grids of the grid to which it belongs to the search range is determined according to the comparison results; S4, performing nearest neighbor search according to the determined search range, calculating the distance, and thus completing clustering; Step S2 includes: S201, divide the grid according to the maximum and minimum longitude and latitude in the GPS track point data set, and the set grid length and width; set For the length of each grid, is the width of each grid; the scale X and Y values ​​of the grid division are: ;in is the maximum longitude, is the minimum precision; ;in is the maximum latitude, is the minimum latitude; S202, sequentially encode the grids, and calculate the grid code according to the latitude and longitude coordinates of the GPS track point data; ;in For data points Longitude, For data points Latitude; For data points The grid number to which it belongs; S203. Divide all GPS trajectory point data into corresponding grids for storage, and perform Geohash conversion and storage on the four vertices of the grid; when the i of the grid is < X and j is < Y, assign the corresponding grid serial number to the grid as i + j * X; according to the grid serial number of the data point calculated in step S202, divide each data point into the grid with the corresponding grid serial number; complete the grid division and the归集 of each data point position; The distances in steps S3 and S4 are calculated by GeoHash; Step S3 specifically includes: If the distance between the GPS track point data and the edge of the grid to which it belongs is less than the search radius, the neighborhood grid corresponding to the edge will be included in the search range, otherwise it will not be included; If the distances between the GPS track point data and the two adjacent edges of the grid to which it belongs are both smaller than the search radius, the neighborhood grid corresponding to the angle between the two adjacent edges will be included in the search range, otherwise it will not be included.

2. A cluster analysis system for trajectory data in the field of spatial data governance, characterized in that: include: Database conversion module: For the GPS track point database, GeoHash is used to convert the longitude and latitude spatial coding for storage; the original longitude and latitude values ​​are converted from decimal to binary storage through GeoHash coding based on the median accuracy; Grid division module: divides the data space into grids according to the longitude and latitude of the GPS track points, and performs GeoHash spatial conversion and storage on the four vertices of the grid; Comparison module: organize the GPS trajectory point data of the grid where the cluster center is located and its surrounding neighborhood grids in a KD-Tree structure; The distances between the cluster center and the four sides of the grid to which it belongs are compared with the search radius, and whether to add the neighboring grids of the grid to which it belongs to the search range is determined according to the comparison results; Clustering module: Perform nearest neighbor search based on the determined search range, calculate distance, and thus complete clustering; The meshing module includes: Division unit: Grid division is performed according to the maximum and minimum longitude and latitude in the GPS track point data set, as well as the set grid length and width; For the length of each grid, is the width of each grid; the scale X and Y values ​​of the grid division are: ;in is the maximum longitude, is the minimum precision; ;in is the maximum latitude, is the minimum latitude; Coding unit: sequentially encodes the grids and calculates the grid code according to the latitude and longitude coordinates of the GPS track point data; ;in For data points Longitude, For data points Latitude; For data points The grid number to which it belongs; Storage unit: Divide all GPS trajectory point data into corresponding grids for storage, and perform Geohash conversion on the four vertices of the grid for storage; when the i of the grid is < X and j is < Y, assign the corresponding grid serial number to the grid as i + j * X; according to the grid serial number of the data point calculated in step S202, divide each data point into the grid with the corresponding grid serial number; complete the grid division and the collection of each data point position; The distances mentioned in the comparison module and the clustering module are calculated by GeoHash; The comparison module includes: The first comparison unit: if the distance between the GPS track point data and the edge of the grid to which it belongs is less than the search radius, the neighborhood grid corresponding to the edge is included in the search range, otherwise it is not included; Second comparison unit: If the distances between the GPS track point data and the two adjacent sides of the grid to which it belongs are both smaller than the search radius, the neighborhood grid corresponding to the angle between the two adjacent sides is included in the search range, otherwise it is not included.