## 3 Methods
### Visualization Method Based on Density Partitioning Clustering Algorithm
#### 3.2.2 Heat Map Visualization Method  
Employing the clustering algorithm proposed in this paper to deal with massive traffic trajectory data can not only avoid unrealistic data reflection and inaccurate clustering results caused by building occlusion but also avoid a large number of invalid data transmissions, thus improving the rendering rate of visualization and enhancing the rendering effect of visualization. This study takes heatmap visualization as an illustrative case and explores data visualization rooted in density-based partitioning clustering algorithms.  
The heatmap [54; 55; 56] is a frequently employed data visualization technique illustrating the density distribution of data. Its intuitive portrayal of urban traffic trajectory data aids individuals in swiftly comprehending data distribution, uncovering latent patterns and regularities, thereby supporting decision-making and problem-solving efforts.  
While crafting a heatmap [57; 58; 59], the initial step involves mapping data points within the screen's visual range. This process gives rise to the dataset \(P_{i}\), as delineated by Equation (5).  
\[P_{i}=(X_{i},Y_{i},Z_{i}) i=1,2,3\ldots \tag{5}\]  
In Equation (5), \(X_{i}\) and \(Y_{i}\) represent the horizontal and vertical coordinates of data points on the screen, respectively, while \(Z_{i}\) denotes the attribute value of the data point. Subsequently, the heatmap's rendering radius 'r' is established. Within the screen space, each data point is positioned within a square grid cell with a side length of r/2. The number of rows and columns in the data grid is determined by the screen coordinates of the data points, as outlined in Equation (6).  
\[\left\{\begin{array}{lr}Rovw=\frac{2y_{i}}{r}&i=1,2,3\ldots\\ Column=\frac{2x_{i}}{r}&\end{array}\right. \tag{6}\]  
In Equation (6), \(x_{i}\) and \(y_{i}\) represent data points' horizontal and vertical coordinates, while 'r' represents the rendering radius. Ultimately, while creating the heatmap, it is imperative to conduct K-means clustering on the set of data points within each grid cell. Suppose the data point set within a specific cell is denoted as \(P_{n}\), where 'n' is the number of data points, and the data points have coordinates \(X_{n}\) and \(Y_{n}\), along with the attribute value \(Z_{n}\). The coordinates \((X,Y)\) and attribute value \((Z)\) for the center of each cell after clustering can be computed using Equation (7). With \((X,Y)\) as the center and extending outward with a radius of 'r', transparent gradient circles are drawn, with the magnitude of its grayscale values contingent upon the \(Z\) value. Once all clustering points have been plotted, a grayscale image is formed, and the heatmap is obtained by assigning colors based on heat level thresholds. In this study, we utilize density-based partitioning clustering algorithms and modify data point attribute values to adjust grayscale values. When performing the heat map visualization expression, it reflects the actual distribution of the data after circumventing the buildings and dramatically improves the data visualization's rendering effect. The complete data processing and visualization process is shown in Figure 4.  
\[\left\{\begin{array}{lr}X=\frac{\sum_{i=1}^{n}X_{i}Z_{i}}{\sum_{i=1}^{n}Z_{i }}&\\ Y=\frac{\sum_{i=1}^{n}Y_{i}Z_{i}}{\sum_{i=1}^{n}Z_{i}}&i=1,2,3\ldots,\text{n} \\ Z=\sum\limits_{i=1}^{n}Z_{i}&\end{array}\right. \tag{7}\]