Map point location aggregation display method and system
By using the binary search method, point shooting method and DBSCAN clustering algorithm in the ECharts map component, the poor performance and poor visual effects caused by a large number of points on the map are solved, and more efficient rendering and more accurate data display are achieved.
Patent Information
- Application Number
- CN202411830577.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-11
AI Technical Summary
The existing ECharts map components lack the ability to automatically aggregate points, resulting in poor performance and poor visual effects when displaying a large number of scattered points on the map, and a simple aggregation strategy may affect the accuracy and readability of the data.
By obtaining the original point data, using the binary search method and point shooting method to filter the points, combining the DBSCAN clustering algorithm to cluster the points, determine the core points and display them on the map, and add labels to indicate the density of the points.
It effectively reduces the burden of map rendering, optimizes the visual effect after point aggregation, and improves the statistical accuracy of the data.
Smart Images

Figure CN119810350A_ABST
Abstract
Description
Technical Field
[0001] The present invention generally relates to the field of data visualization technology. More specifically, the present invention relates to a map point aggregation display method and system. Background Art
[0002] Map point aggregation display is a commonly used technology in data visualization. Especially when processing geographic location data, it can effectively reduce the visual disturbance caused by point overlap while improving performance and user experience.
[0003] ECharts (Enterprise Charts) is an open source, JavaScript-based data visualization library that is mainly used to generate interactive charts and data displays. In ECharts, point aggregation is usually used to display a large amount of scattered data, aggregating multiple similar points to better show the distribution trend and density of the data and avoid crowded and unclear charts due to overly dense data.
[0004] However, when using the ECharts map component to display a large amount of point data, there is a lack of automatic point aggregation function, which leads to poor performance and poor visual effects when displaying a large number of scattered points on the map. In addition, the existing simple aggregation strategy may cause point data to be aggregated across different administrative divisions (such as provinces, cities, districts, counties, etc.), affecting the accuracy and readability of the data. Therefore, an effective solution is needed to improve the display and statistical accuracy of point aggregation. Summary of the invention
[0005] In order to solve the technical problems that the existing ECharts map component lacks an effective point aggregation function, resulting in poor performance and poor visual effects when displaying large-scale data, and aggregation may affect the accuracy of the data, the present invention provides solutions in the following aspects.
[0006] In a first aspect, a method for displaying map point aggregation includes obtaining point information in an original point data set, wherein the point information includes longitude, latitude, status, and type of the point; The boundary of the area is obtained, and all the points in the area are screened by binary search method according to the latitude and longitude coordinates of each edge point in the area to obtain the coarse screened points; all the coarse screened points in the area are screened by point shooting method according to the latitude and longitude coordinates of each edge point in the area to obtain the points in the area; the points in the area are clustered according to the coordinates of the points and by DBSCAN algorithm, and the points determined as core objects are determined as core points; the core points of each area are drawn on the map image to obtain a map image after point aggregation, wherein the core points in the map image after point aggregation are added with a first label, and the first label is the number of adjacent points of the core point plus one.
[0007] Preferably, a method for displaying map point aggregation also includes obtaining a map image before point aggregation: drawing each point on the map image to obtain the map image before point aggregation, wherein the core point in the map image before point aggregation is added with a second label, and the second label is the point information of the point.
[0008] Preferably, screening all points in the region by binary search method includes: determining the binary range of the region, the binary range of the region is the longitude range or latitude range of the region, and the longitude range of the region is [ α min , α max ], α max is the maximum value of the longitude value in the longitude and latitude coordinates of the edge points of the area. α min is the minimum value of the longitude value in the longitude and latitude coordinates of the edge points of the region. The latitude range of the region is [ β min , β max ], β max is the maximum value of the latitude and longitude coordinates of the edge points of the area. β min It is the minimum value of the latitude and longitude coordinates of the edge points of the region; the points within the binary range of the region are determined as the coarse screening points of the region.
[0009] A map point aggregation display method screens all coarse screening points in a region by a point shooting method, including: connecting the edge points of the region in a preset order to obtain all line segments corresponding to the edge line of the region; obtaining the number of intersections of all line segments corresponding to the edge line of the region with the coarse screening point of the region as the starting point and the ray of the preset direction, recorded as the number of intersections of the coarse screening point, wherein the direction of the ray corresponding to each coarse screening point in the region is the preset direction; determining whether each coarse screening point is a point within the boundary of the region according to the number of intersections corresponding to each coarse screening point, wherein in response to the number of intersections of the coarse screening point being an odd number, the coarse screening point is determined to be a point within the boundary of the region, and in response to the number of intersections of the coarse screening point being an even number, the coarse screening point is determined not to be a point within the boundary of the region.
[0010] A method for displaying map points in aggregate to determine the first order of magnitude of the ray corresponding to the coarse screening point and the edge line of the region i Whether there is an intersection between the line segments includes: calculating the judgment value of the coarse screening point : , where the direction of the ray corresponding to the coarse screening point is x The positive direction of the axis is established in a two-dimensional Cartesian coordinate system, ( x 0 , y 0 ) is the coordinate of the coarse screening point, ( x i,1 , y i,1 )and( x i,2 , y i,2 ) The edge line of the area i The two endpoints of a line segment, i is any positive integer; in response to , determine the first i The line segments have intersection points.
[0011] Preferably, a map point aggregation display method also includes: clustering the points in the area to determine the noise points, and drawing the noise points on the map image before the point aggregation, wherein the label of the noise points in the map image before the point aggregation is 1.
[0012] Preferably, determining the core points and noise points of an area includes: determining the core points and noise points of an area includes: calculating the distance between the points in the area, and determining that the points in the two areas whose distance is less than a distance threshold corresponding to the area are adjacent points to each other; determining the core points, wherein the number of adjacent points of the core points is greater than a number threshold of a preset size; determining the boundary points, wherein the number of adjacent points of the boundary points is less than or equal to the number threshold, and the edge points and at least one core point are adjacent points to each other; determining that the points other than the core points and edge points in the area are noise points.
[0013] Preferably, a method for displaying map points in aggregate further includes determining a distance threshold corresponding to a region: obtaining the area of the region S And the total number of points in the area N ; Calculate the distance threshold of the area, where the calculation formula is: , D is the distance threshold of the region, k Correction parameters for preset sizes.
[0014] Preferably, the edge nodes of each region are configured with a unique index, and the edge points of each region are obtained through the unique index corresponding to each region.
[0015] In a second aspect, a map point aggregation display system includes a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to implement a map point aggregation display method as described in any one of the above invention contents.
[0016] The beneficial effects of the present invention are: After the present invention aggregates the points on the map through the DBSCAN clustering algorithm, the core points (i.e., the core objects obtained by clustering) will be selected as the mark of each cluster and displayed on the second layer (the second layer is the first layer), and the first layer will display all the points. Based on this, the present invention obtains the aggregated points that need to be displayed after the points are aggregated through the clustering algorithm, reducing the burden of map rendering. Because the core points are located at the center of the cluster, they can effectively represent the point density of the area, thereby optimizing the visual effect after the points are aggregated. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein: Figure 1 is a flowchart schematically illustrating a method for displaying map points in an aggregated manner according to an embodiment of the present invention; Figure 2 The figure schematically shows a structural block diagram of a map point aggregation display system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0019] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0020] Figure 1 The figure is a flowchart schematically showing the steps of a method for displaying map points in an aggregated manner according to an embodiment of the present invention.
[0021] like Figure 1 As shown, a method for displaying map point aggregation includes steps S1 to S4.
[0022] Step S1: Acquire point information in the original point data set, wherein the point information includes the longitude, latitude, status and type of the point.
[0023] It should be noted that points refer to specific data points marked on the map, which are usually represented by longitude and latitude coordinates. In the application scenario of ECharts map components, points are usually used to display the distribution of geographical locations to help users understand the geographical distribution trend of data. In one embodiment, the map is divided into regions according to different levels of administrative districts such as regions and counties.
[0024] In one embodiment, in order to facilitate the acquisition and processing of data, each region is configured with a unique index. Through the unique index of the region, the coordinates of the edge coordinate points of the region can be directly obtained without traversing all points in the region one by one, thereby improving efficiency.
[0025] Step S2: Obtain the boundary of the region, and screen all the points in the region by binary search method according to the longitude and latitude coordinates of each edge point in the region to obtain coarse screening points.
[0026] In one embodiment, screening all points in a region by binary search includes: determining a binary range of the region, where the binary range of the region is a longitude range or a latitude range of the region, and the longitude range of the region is [ α min , α max ],α max is the maximum value of the longitude value in the longitude and latitude coordinates of the edge points of the area. α min is the minimum value of the longitude value in the longitude and latitude coordinates of the edge points of the region. The latitude range of the region is [ β min , β max ], β max is the maximum value of the latitude and longitude coordinates of the edge points of the area. β min It is the minimum value of the latitude and longitude coordinates of the edge points of the region; the points within the binary range of the region are determined as the coarse screening points of the region.
[0027] Step S3: All the rough screening points in the area are screened by the point shooting method according to the longitude and latitude coordinates of each edge point in the area to obtain the points in the area.
[0028] In one embodiment, screening all coarse screening points in an area by a point shooting method includes: connecting the edge points of the area in a preset order to obtain all line segments corresponding to the edge line of the area; obtaining the number of intersections of rays with the coarse screening points of the area as starting points and a preset direction with all line segments corresponding to the edge line of the area, recorded as the number of intersections of the coarse screening points, wherein the directions of the rays corresponding to each coarse screening point in the area are all preset directions; determining whether each coarse screening point is a point within the boundary of the area according to the number of intersections corresponding to each coarse screening point, wherein in response to the number of intersections of the coarse screening point being an odd number, the coarse screening point is determined to be a point within the boundary of the area, and in response to the number of intersections of the coarse screening point being an even number, the coarse screening point is determined not to be a point within the boundary of the area.
[0029] It should be noted that all points are sorted by their longitude or latitude (only one of the two is selected), and then binary search is used to quickly determine which points' longitude or latitude falls within the preset range. After the rough screening, the points obtained are likely to still contain some points near the region boundary. At this time, the ray method is needed for further screening to determine which points are actually in the region. The ray method is a commonly used point-in-polygon (whether a point is in a polygon) determination algorithm. The basic idea is: send a ray (usually horizontally or vertically) from the point to be detected, and check whether the ray crosses the region boundary. If the number of intersections is an odd number, it means that the point is in the region; if the number of intersections is an even number, it means that the point is outside the region.
[0030] In one embodiment, the first step of determining the relationship between the ray corresponding to the coarse screening point and the edge line of the region is as follows: i Whether there is an intersection between the line segments includes: calculating the judgment value of the coarse screening point : .
[0031] Among them, the direction of the ray corresponding to the coarse screening point is x The positive direction of the axis is established in a two-dimensional Cartesian coordinate system, ( x 0 , y 0 ) is the coordinate of the coarse screening point, ( x i,1 , y i,1 )and( x i,2 , y i,2 ) The edge line of the area i The two endpoints of a line segment, i is any positive integer; in response to , determine the first i There are intersections of line segments. It should be noted that the judgment value is the horizontal coordinate of the intersection of the ray corresponding to the coarse screening point and the edge line.
[0032] Step S4: clustering the points in the area according to the coordinates of the points through the DBSCAN algorithm, and determining the points determined as core objects as core points.
[0033] Among them, the points determined as core objects are determined as core points, the points determined as boundary points are determined as boundary points, and the points determined as noise points are determined as noise points.
[0034] Furthermore, the present invention also includes clustering the points in the area to determine the noise points, and drawing the noise points on the map image before the point aggregation, wherein the label of the noise points in the map image before the point aggregation is 1.
[0035] It should be noted that the present invention uses the clustering algorithm DBSCAN (Density-Based Spatial Clustering of Applications with Noise), which is a density-based clustering algorithm that clusters similar points together according to the density of data points and can identify noise points. The main feature of DBSCAN is that it does not require a preset number of clusters, but divides clusters according to the density of the data.
[0036] Among them, core object (Core Point, core point) is a concept in DBSCAN. A core object refers to a point whose ε neighborhood (ε is the distance threshold in the present invention) has at least MinPts (MinPts is the number threshold in the present invention), that is, the core point is a representative point of a dense area. A border point refers to a point in the ε neighborhood of a core point, but the number of points in its own ε neighborhood is less than MinPts. Therefore, a border point does not have the conditions to become a core point, but it is located in the neighborhood of the core point and can belong to a cluster. A noise point refers to a point that is neither a core point nor a border point. Noise points are those points that do not belong to any cluster.
[0037] In one embodiment, determining the core points, edge points and noise points of an area includes: calculating the distance between the points in the area, and determining that the points in the two areas whose distance is less than a distance threshold corresponding to the area are adjacent points to each other; determining the core points, wherein the number of adjacent points of the core points is greater than a number threshold of a preset size; determining the boundary points, wherein the number of adjacent points of the boundary points is less than or equal to the number threshold, and the edge points are adjacent points to at least one core point; and determining that the points other than the core points and edge points in the area are noise points.
[0038] Furthermore, the present invention further includes determining the distance threshold corresponding to each area: further includes determining the distance threshold corresponding to the area: obtaining the area of the area S And the total number of points in the area N ; Calculate the distance threshold of the area, where the calculation formula is: , D is the distance threshold of the region, k Correction parameters for preset sizes.
[0039] It should be noted that when the area of a region increases, in order to maintain a reasonable judgment of the proximity between points, the distance threshold needs to be increased. When the total number of points increases, it means that the density of the region is larger and the number of neighboring points is relatively larger. Therefore, in order to accurately judge the relationship between points, the distance threshold should be reduced. Based on this, the larger the area of a region, the larger the distance threshold of the region; the larger the total number of points in a region, the smaller the distance threshold of the region.
[0040] Step S5: Draw the core points of each area on the map image to obtain a map image after point aggregation.
[0041] The core point in the map image after point aggregation is added with a first label, and the first label is the number of adjacent points of the core point plus one.
[0042] Furthermore, the method also includes obtaining a map image before point aggregation: drawing each point on the map image to obtain the map image before point aggregation, wherein the core point in the map image before point aggregation is added with a second label, and the second label is the point information of the point.
[0043] In one embodiment, the present invention obtains images before and after aggregation through ECharts. A unique identifier is added to each region; a data list corresponding to the region is constructed through the unique identifier of the region, wherein the data list of the region includes a noise list and at least one aggregation list, the noise list includes the longitude and latitude coordinates of the noise points of the region, the number of the aggregation lists is equal to the number of core points in the region obtained by clustering, and the first j The cluster list includes the j The core points and j The longitude and latitude coordinates of all adjacent points of a core point, j is a positive integer; after converting the data list of each area into a series data structure, the data list of each area is visualized through ECharts to obtain the first coordinate point and the second coordinate point.
[0044] Figure 2 FIG. 4 is a block diagram schematically showing a structure of a map point aggregation display system according to this embodiment.
[0045] The present invention also provides a map point aggregation display system. Figure 2 As shown, the system includes a processor and a memory, the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a map point aggregation display method according to the first aspect of the present invention is implemented.
[0046] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus or device. For example, a computer-readable storage medium may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that can be used to store the required information and can be accessed by an application, a module, or both. Any such computer storage medium may be part of a device or accessible or connectable to a device. Any application or module described in the present invention may be implemented using computer-readable / executable instructions that may be stored or otherwise maintained by such a computer-readable medium.
[0047] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0048] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A method for displaying map points in aggregate, characterized in that: include: Obtaining point information in the original point data set, wherein the point information includes the longitude, latitude, status and type of the point; Obtain the boundary of the area, and screen all points in the area by binary search method according to the longitude and latitude coordinates of each edge point in the area to obtain the rough screening points; According to the longitude and latitude coordinates of each edge point in the area, all the rough screening points in the area are screened by the point shooting method to obtain the points in the area; According to the coordinates of the points, the points in the area are clustered using the DBSCAN algorithm, and the points identified as core objects are identified as core points; The core points of each area are drawn on the map image to obtain a point-aggregated map image, wherein the core points in the point-aggregated map image are added with a first label, and the first label is the number of adjacent points of the core point plus one.
2. A method for displaying map points in aggregate according to claim 1, characterized in that: It also includes obtaining the map image before point aggregation: Each point is drawn on the map image to obtain a map image before point aggregation, wherein a core point in the map image before point aggregation is added with a second label, and the second label is the point information of the point.
3. A method for displaying map points in aggregate according to claim 1, characterized in that: The binary search method is used to filter all points in the area, including: Determine the binary range of the region, the binary range of the region is the longitude range or latitude range of the region, the longitude range of the region is [ α min , α max ], α max is the maximum value of the longitude value in the longitude and latitude coordinates of the edge points of the area. α min is the minimum value of the longitude value in the longitude and latitude coordinates of the edge points of the region. The latitude range of the region is [ β min , β max ], β max is the maximum value of the latitude and longitude coordinates of the edge points of the area. β min It is the minimum value of the latitude and longitude coordinates of the edge points of the area; Determine the points within the binary range of the region as the coarse screening points of the region.
4. A method for displaying map points in aggregate according to claim 1, characterized in that: Screening all the rough screening points in the area by the spot shooting method includes: Connect the edge points of the region in a preset order to obtain all line segments corresponding to the edge line of the region; Obtain the number of intersections of all line segments corresponding to the edge lines of the region and the rays of the preset direction starting from the rough screening point of the region, which is recorded as the number of intersections of the rough screening points, wherein the directions of the rays corresponding to the rough screening points in the region are all preset directions; Whether each coarse screening point is a point within the boundary of the area is determined according to the number of intersection points corresponding to each coarse screening point. In response to the number of intersection points of the coarse screening point being an odd number, the coarse screening point is determined to be a point within the boundary of the area; in response to the number of intersection points of the coarse screening point being an even number, the coarse screening point is determined not to be a point within the boundary of the area.
5. A method for displaying map points in aggregate according to claim 4, characterized in that: Determine the first i Whether there is an intersection between the line segments includes: Calculate the judgment value of the coarse screening point : , where the direction of the ray corresponding to the coarse screening point is x The positive direction of the axis is established in a two-dimensional Cartesian coordinate system, ( x 0, y 0) is the coordinate of the coarse screening point, ( x i,1 , y i,1 )and( x i,2 , y i,2 ) The edge line of the area i The two endpoints of a line segment, i is any positive integer; In response to , determine the first i The line segments have intersection points.
6. A method for displaying map points in aggregate according to claim 1, characterized in that: The method also includes clustering the points in the area to determine the noise points, and drawing the noise points on the map image before the point aggregation, wherein the label of the noise points in the map image before the point aggregation is 1.
7. A method for displaying map points in aggregate according to claim 6, characterized in that: The core points and noise points of the determined area include: Calculate the distance between each point in the area, and determine that the points in two areas whose distance is less than the distance threshold corresponding to the area are adjacent points; Determine a core point, wherein the number of adjacent points of the core point is greater than a preset number threshold; Determine a boundary point, wherein the number of adjacent points of the boundary point is less than or equal to the number threshold, and the edge point and at least one core point are adjacent points to each other; Points other than core points and edge points in the region are determined as noise points.
8. A method for displaying map points in aggregate according to claim 7, characterized in that: It also includes determining the distance threshold corresponding to the area: Get the area of a region S And the total number of points in the area N ; Calculate the distance threshold of the area, where the calculation formula is: , D is the distance threshold of the region, k Correction parameters for preset sizes.
9. The point aggregation display method based on ECharts map component according to claim 1 is characterized in that: The edge nodes of each region are configured with a unique index, and the edge points of each region are obtained through the unique index corresponding to each region.
10. A map point aggregation display system, comprising a processor and a memory, wherein the memory stores a computer program, characterized in that: The processor executes the computer program to implement a map point aggregation display method as described in any one of claims 1-9.