A method for displaying a large number of location points on an electronic map
By calculating and selecting an appropriate point aggregation algorithm on the server side, the problem of data transmission and client resource consumption in the display of massive location points is solved, and the user experience and computing efficiency are improved.
Patent Information
- Application Number
- CN202111114745.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-23
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-09-23
AI Technical Summary
When existing map services display massive location points, data transmission occupies a large amount of bandwidth, increases data transmission time, consumes client resources, and affects user experience. In particular, the point aggregation algorithm causes system lags under large amounts of data.
A method of displaying massive location points on electronic maps is adopted. The client requests the visual range and zoom level, and the server queries and calculates the aggregate point set. Combined with the point aggregation algorithm based on grids and distances, the system uses the point aggregation algorithm based on grids and distances to calculate the number of data points and the visual range area. Choose an appropriate algorithm to reduce the computational burden on the client and rely on server calculations.
It effectively reduces the data request time, reduces client resource consumption, improves user experience, and avoids the performance problems of the point aggregation algorithm under large data volumes. It combines the advantages of the two algorithms to maintain fast calculation and accurate aggregation.
Smart Images

Figure CN113849588B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic maps, and in particular to a method for displaying a large number of location points on an electronic map. Background Art
[0002] At present, the SDK provided by existing mainstream map service providers can only display massive location points by requiring the client to first request data from the server, then calculate the aggregated point set through a point aggregation algorithm (generally a point set algorithm based on a combination of grids and distances), and finally render it onto the map.
[0003] The existing technology displays massive data points by first requesting all the data from the server. If the amount of data is very large, data transmission will not only occupy a large amount of bandwidth, but also increase the data transmission time, greatly consuming customer traffic resources and increasing data refresh delays, affecting user experience. After the client receives the data, it calculates the aggregation point set through the point aggregation algorithm, and then renders it to the map for display. Since the point aggregation algorithm has iterative operations for each location point, if the amount of data is very large, there are defects such as consuming a large amount of network bandwidth, occupying client CPU resources, and being very dependent on client hardware resources, which can cause system freezes in severe cases.
[0004] Therefore, it is necessary to develop a method for displaying a large number of location points on an electronic map to solve the above problems. Summary of the invention
[0005] The purpose of the present invention is to design a method for displaying a large number of location points on an electronic map in order to solve the above-mentioned problem.
[0006] The present invention achieves the above-mentioned purpose through the following technical solutions:
[0007] A method for displaying a large number of location points on an electronic map, comprising:
[0008] S1, obtain client request; proceed to step S2;
[0009] S2, generating parameter 1 and parameter 2 according to the client request; wherein parameter 1 is the visible range, and parameter 2 is the zoom level; proceeding to step S3;
[0010] S3, query all data points within the visible range from the database; proceed to step S4;
[0011] S4, determine whether the total number of data points is less than a certain threshold; if yes, proceed to step S6, if not, proceed to step S5;
[0012] S5, determine whether the visible range area is less than a certain threshold; if so, proceed to step S6, if not, proceed to step S7;
[0013] S6, using a point aggregation algorithm based on a combination of grids and distances to calculate an aggregation point set; proceeding to step S8;
[0014] S7, using a grid-based point aggregation algorithm to calculate and obtain an aggregated point set; proceeding to step S8,
[0015] S8. Send the aggregation point set to the server, and start client rendering after the server responds.
[0016] The beneficial effects of the present invention are:
[0017] With the server as the core, relying on the powerful computing power of the server, the complex point aggregation algorithm is placed on the server for calculation, and the technical idea of calculating first, responding later, and rendering is adopted, which makes the client highly lightweight;
[0018] A combination of two algorithms is adopted. When the total number of data points is less than a certain threshold or the visible range area is less than a certain threshold, a grid-based point aggregation algorithm is adopted. In other cases, a faster grid and distance-based point aggregation algorithm is adopted. The advantages of the two algorithms, namely, faster operation speed and more accurate reflection of the location information of the original point elements contained therein, are retained, while the disadvantages of the two algorithms are avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is a method flow chart of the present application;
[0020] Figure 2 is a flow chart of the grid-based point aggregation algorithm in this application;
[0021] Figure 3 is a flowchart of the point aggregation algorithm based on grid and distance in this application;
[0022] Figure 4 is a flow chart of the request mechanism in this application; DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0024] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0026] In the description of the present invention, it should be understood that the terms "upper", "lower", "inside", "outside", "left", "right", etc. indicate directions or positional relationships based on the directions or positional relationships shown in the accompanying drawings, or are directions or positional relationships in which the product of the invention is usually placed when in use, or are directions or positional relationships commonly understood by those skilled in the art. These directions or positional relationships are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as a limitation on the present invention.
[0027] Furthermore, the terms “first”, “second”, etc. are merely used for distinguishing descriptions and should not be understood as indicating or implying relative importance.
[0028] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms such as "setting" and "connection" should be understood in a broad sense. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or an indirect connection through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0029] The specific implementation modes of the present invention are described in detail below in conjunction with the accompanying drawings.
[0030] like Figure 1 As shown, a method for displaying a large number of location points on an electronic map includes:
[0031] S1, obtain client request; proceed to step S2;
[0032] S2. Generate parameters 1 and 2 according to the client request; parameter 1 is the visible range, and parameter 2 is the zoom level; enter step S3; the client needs to pass in two parameters when requesting data from the server, namely the map visible range and the current zoom level. The map visible range is the map boundary displayed on the current map on the display terminal, which is usually a rectangle, expressed in northeast (northeast) and southwest (southwest) longitude and longitude. For the visible range, the longitude range is [-180°, 180°], and the latitude range is [-90°, 90°]. If 180° east longitude is not within the visible range, the longitude of northeast is greater than the longitude of southwest; if 180° east longitude is within the visible range, the longitude of northeast is less than the longitude of southwest. At the same time, the query database data and point aggregation calculation are divided into two sections for query and calculation according to [west, 180°] and [-180°, east].
[0033] S3, query all data points within the visible range from the database; proceed to step S4;
[0034] S4, determine whether the total number of data points is less than a certain threshold; if yes, proceed to step S6, if not, proceed to step S5;
[0035] S5, determine whether the visible range area is less than a certain threshold; if so, proceed to step S6, if not, proceed to step S7;
[0036] S6, using a point aggregation algorithm based on a combination of grids and distances to calculate an aggregation point set; proceeding to step S8;
[0037] S7, using a grid-based point aggregation algorithm to calculate and obtain an aggregated point set; proceeding to step S8,
[0038] S8. Send the aggregation point set to the server, and start client rendering after the server responds.
[0039] like Figure 2 As shown, the aggregated point set calculated by the grid-based point aggregation algorithm includes:
[0040] S71, calculate the longitude step and the latitude step; proceed to step S72;
[0041] S72, calculating the range set of each segmented grid in the visible range according to the visible range, longitude step, and latitude step; proceeding to step S73;
[0042] S73, select a location point; proceed to step S74;
[0043] S74, traverse all grid sets to determine whether the location point is within the grid, if yes, proceed to step S75, if not, proceed to step S76;
[0044] S75, add the location point to the grid and add 1 to the count; go to step S77;
[0045] S76, determine whether the traversal is completed; if so, proceed to step S77, if not, proceed to step S74;
[0046] S77, determine whether it is the last position point; if yes, proceed to step S78, if not, proceed to step S73;
[0047] S78. Remove the grids without position points in the grid.
[0048] like Figure 3 As shown in the figure, the point aggregation algorithm based on the combination of grid and distance is used to calculate the aggregation point set, including:
[0049] S61, calculate the longitude step and the latitude step; proceed to step S62;
[0050] S62, select a location point; proceed to step S63;
[0051] S63, traverse the aggregation point set, determine whether the location point is within the aggregation point range, if yes, proceed to step S64, if not, proceed to step S65;
[0052] S64, calculate the distance between the position point and the center of the aggregation point, and record the aggregation point S1 with the shortest distance; proceed to step S65;
[0053] S65, determine whether the traversal is completed; if so, proceed to step S66, if not, proceed to step S63;
[0054] S66, determine whether the shortest distance aggregation point S1 exists; if yes, proceed to step S68, if not, proceed to step S67;
[0055] S67, create a new empty aggregation point S1; go to step S68;
[0056] S68, adding the position point obtained in step S64 or step S67 to the aggregation point S1, and adding 1 to the count; recalculating the center point of the aggregation point according to the average method, and recalculating the grid range of the aggregation point according to the longitude step and the latitude step; proceeding to step S69;
[0057] S69, determine whether it is the last position point, if yes, end; if not, go to step S62.
[0058] like Figure 4 As shown, the method for generating parameter 1 and parameter 2 according to the client request includes:
[0059] S21, the client monitors the data request flag bit according to a certain set threshold time period, and if the flag bit is enabled, requests data once, and clears the flag bit after the request is completed. If the flag bit cannot be enabled, proceed to step S22;
[0060] S22, determine whether the zoom level has changed, if so, proceed to step S24, if not, proceed to step S23;
[0061] S23, determine whether the visible range K1 is within the last requested visible range K2, where K2 is 1.1 times K1; if yes, skip the request; if not, proceed to step S24;
[0062] S24, expand the visible range from K1 to K2;
[0063] S25, generating parameter 1 and parameter 2; wherein parameter 1 is the expansion range K2, and parameter 2 is the zoom level.
[0064] The calculation of longitude step and latitude step in the grid-based point aggregation algorithm and the grid-based and distance-based point aggregation algorithm are both: according to formula 2 x-1 Calculate the number of grid divisions, where x is the zoom level; then divide the north-south and east-west directions by 180° and 360° by the number of grid divisions to calculate the grid lengths in the north-south and east-west directions respectively; the grid length in the east-west direction is the longitude step, and the grid length in the north-south direction is the latitude step.
[0065] When implementing this technical solution, a threshold can be set. When the number of location points in the calculated aggregation point is less than the threshold, the aggregation point can be dissolved and the location point information can be directly responded to. At the same time, a threshold can be set for the zoom level. When the zoom level is greater than the threshold, the point aggregation algorithm is not used and the location point set is directly responded to.
[0066] This technical solution effectively solves the shortcomings of the existing technology that the point aggregation algorithm is placed on the client side for calculation, which consumes network bandwidth, occupies client resources, and is overly dependent on client hardware resources. And relying on the powerful computing power of the server side, it can effectively reduce the data request time and improve the user experience.
[0067] The technical solution of the present invention is not limited to the above-mentioned specific embodiments. All technical variations made according to the technical solution of the present invention fall within the protection scope of the present invention.
Claims
1. A method for displaying a large number of location points on an electronic map, characterized in that: include: S1. Get client request; Go to step S2; S2, generate parameter 1 and parameter 2 according to the client request; Parameter 1 is the visible range, and parameter 2 is the zoom level; Go to step S3; Methods for generating parameter 1 and parameter 2 according to client request include: S21, the client monitors the data request flag bit according to a certain set threshold time period, and if the flag bit is enabled, requests data once, and clears the flag bit after the request is completed. If the flag bit cannot be enabled, proceed to step S22; S22, determine whether the zoom level has changed, if so, proceed to step S24, if not, proceed to step S23; S23, determine whether the visible range K1 is within the last requested visible range K2, where K2 is 1.1 times K1; if yes, skip the request; if not, proceed to step S24; S24, expand the visible range from K1 to K2; S25, generating parameter 1 and parameter 2, wherein parameter 1 is the expansion range K2, and parameter 2 is the zoom level; S3, query all data points within the visible range from the database; proceed to step S4; S4, determine whether the total number of data points is less than a certain threshold; if yes, proceed to step S6, if not, proceed to step S5; S5, determine whether the visible range area is less than a certain threshold; if so, proceed to step S6, if not, proceed to step S7; S6, using a point aggregation algorithm based on a combination of grids and distances to calculate an aggregated point set; proceeding to step S8; using a point aggregation algorithm based on a combination of grids and distances to calculate an aggregated point set includes: S61, calculate the longitude step and the latitude step; proceed to step S62; S62, select a location point; proceed to step S63; S63, traverse the aggregation point set, determine whether the location point is within the aggregation point range, if yes, proceed to step S64, if not, proceed to step S65; S64, calculate the distance between the position point and the center of the aggregation point, and record the aggregation point S1 with the shortest distance; proceed to step S65; S65, determine whether the traversal is completed; if so, proceed to step S66, if not, proceed to step S63; S66, determine whether the shortest distance aggregation point S1 exists; if yes, proceed to step S68, if not, proceed to step S67; S67, create a new empty aggregation point S1; go to step S68; S68, adding the position point obtained in step S64 or step S67 to the aggregation point S1, and adding 1 to the count; recalculating the center point of the aggregation point according to the average method, and recalculating the grid range of the aggregation point according to the longitude step and the latitude step; proceeding to step S69; S69, determine whether it is the last position point, if yes, end; if not, go to step S62; S7, using a grid-based point aggregation algorithm to calculate an aggregated point set; entering step S8, using a grid-based point aggregation algorithm to calculate an aggregated point set includes: S71, calculating the longitude step and the latitude step, wherein the length of the grid in the east-west direction is the longitude step, and the length of the grid in the north-south direction is the latitude step; proceeding to step S72; S72, calculating the range set of each segmented grid in the visible range according to the visible range, longitude step, and latitude step; proceeding to step S73; S73, select a location point; proceed to step S74; S74, traverse all grid sets to determine whether the location point is within the grid, if yes, proceed to step S75, if not, proceed to step S76; S75, add the location point to the grid and add 1 to the count; go to step S77; S76, determine whether the traversal is completed; if so, proceed to step S77, if not, proceed to step S74; S77, determine whether it is the last position point; if yes, proceed to step S78, if not, proceed to step S73; S78, removing the grid without position points in the grid; S8. Send the aggregation point set to the server, and start client rendering after the server responds.
2. A method for displaying a large number of location points on an electronic map according to claim 1, characterized in that: The calculation of longitude step and latitude step includes: according to formula 2 x-1 The number of grid divisions is calculated, where x is the zoom level; then the grid lengths in the north-south and east-west directions are calculated by dividing the amplitude of 180° and 360° in the north-south and east-west directions by the number of grid divisions.
