Map processing methods, devices, terminals, and storage media
By generating grid index numbers and assigning point data to grids based on predetermined side lengths, the problem of low efficiency in map heatmap construction in existing technologies is solved, achieving more efficient grid aggregation and shortening map construction time.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2022-12-30
- Publication Date
- 2026-06-30
AI Technical Summary
Existing technologies, when constructing map heatmaps, suffer from low backend computation efficiency and long processing times due to the cross-collision traversal algorithm of grid data and point data.
By generating grid index numbers and assigning point data to grids based on predetermined side lengths, a map is directly formed, avoiding the process of pre-constructing grid data and traversing the entire grid data.
It improved grid aggregation efficiency, shortened map building time, and enhanced computational efficiency.
Smart Images

Figure CN116644142B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to, but is not limited to, the fields of big data technology or map technology, and particularly to a map processing method, apparatus, terminal and storage medium. Background Technology
[0002] With the rapid development of internet technology, various information products are emerging in increasing numbers. Most data in daily life is related to spatial location. In the field of big data technology, map heatmaps are one of the most common display products; map heatmaps use a special highlighted format to show the areas of interest to visitors and the geographical area where the visitors are located. The data for map heatmaps mainly comes from mobile internet and / or the Internet of Things, and the proportion of spatial location data in these heatmaps is even higher; therefore, the demand for data cleaning, data aggregation, and data visualization is growing daily.
[0003] In related technologies, a grid overlay layer is pre-added to the map in the background of a map heatmap, meaning that grid overlay data needs to be generated in advance. Then, massive amounts of latitude and longitude point data are obtained from the server. Finally, the relationship between the massive amount of latitude and longitude point data and each grid is traversed, and data falling into the same grid are aggregated to achieve the effect of grid aggregation. However, when constructing a map heatmap using this method and performing attribution calculations on a large amount of grid data and a large amount of point data, a cross-collision traversal algorithm is required, resulting in low backend calculation efficiency and long processing time. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a map processing method, apparatus, terminal, and storage medium to at least solve some of the above-mentioned technical problems.
[0005] The technical solution of this invention is implemented as follows:
[0006] In a first aspect, embodiments of the present invention provide a map processing method, the method comprising:
[0007] Multiple grid index numbers are generated based on multiple point data; wherein, one point data corresponds to one grid index number;
[0008] Based on multiple grid index numbers and a predetermined side length, the multiple grid index numbers are assigned to multiple grids; wherein, a grid is constructed based on a grid index number and a corresponding predetermined grid index number, and the predetermined grid index number is generated based on the grid index number and the predetermined side length.
[0009] Multiple grid index numbers from multiple grids are aggregated to form a map.
[0010] In the above scheme, the plurality of point data includes at least: first point data and second point data;
[0011] The process of generating multiple grid index numbers based on multiple point data includes:
[0012] A first grid index number is generated based on the first point data, and a second grid index number is generated based on the second point data;
[0013] The step of assigning multiple grid index numbers to multiple grids based on multiple grid index numbers and a predetermined side length includes:
[0014] A first predetermined grid index number is generated based on the first grid index number and the predetermined side length;
[0015] Determine whether the second grid index number is in the first grid. If so, assign the second grid index number to the first grid. The first grid is constructed based on the first grid index number and the first grid index number.
[0016] The aggregation of multiple grid index numbers from multiple grids to form a map includes:
[0017] The first grid index number and the second grid index number in the first grid are combined to form the map that includes at least the first grid.
[0018] In the above scheme, assigning multiple grid index numbers to multiple grids based on multiple grid index numbers and a predetermined side length includes:
[0019] If it is determined that the second grid index number is not in the first grid, the second grid index number of the second point data is re-determined based on the first grid index number and the predetermined side length or based on the first predetermined grid index number and the predetermined side length;
[0020] The second grid index number is assigned to the second grid; wherein the second grid is constructed based on the re-determined second grid index number and the second predetermined grid index number, and the second predetermined grid index number is generated based on the re-determined second grid index number and the predetermined side length;
[0021] The aggregation of multiple grid index numbers from multiple grids to form a map includes:
[0022] The first grid index number in the first grid and the second grid index number in the second grid are combined to form the map, which includes at least the first grid and the second grid.
[0023] In the above scheme, the method includes:
[0024] Based on the predetermined side length and predetermined latitude distance, the longitude difference is determined; wherein, the predetermined latitude distance is determined by the predetermined longitude distance and the latitude of the point data, and the point data includes the first point data;
[0025] The latitude difference is determined based on the predetermined side length and the predetermined longitude distance;
[0026] The step of generating the first grid index number based on the first point data includes:
[0027] Based on the longitude of the first point data and the longitude difference, determine the first longitude coordinates of the first point data;
[0028] Based on the latitude of the first point data and the latitude difference, determine the first latitude coordinates of the first point data;
[0029] Based on the first longitude coordinates and the first latitude coordinates, determine the first grid index number of the first point data.
[0030] In the above scheme, generating the first predetermined grid index number based on the first grid index number and the predetermined side length includes:
[0031] The second longitude coordinate of the first point data is determined based on the sum of the first longitude coordinates and the longitude difference of the first point data.
[0032] The second latitude coordinate of the first point data is determined based on the sum of the first latitude coordinate and the latitude difference of the first point data.
[0033] Based on the second longitude coordinates and the second latitude coordinates, the first predetermined grid index number of the first point data is determined.
[0034] In the above scheme, the step of aggregating multiple grid index numbers from multiple grids to form a map includes:
[0035] If multiple grid index numbers are in the same grid, determine any one of the multiple grid index numbers in the grid as the target grid index number;
[0036] A map is formed based on the target grid index number among the multiple grids.
[0037] In the above scheme, the method includes: adjusting the predetermined side length based on the reduction ratio.
[0038] Secondly, embodiments of the present invention provide a map processing apparatus, comprising:
[0039] A generation module is used to generate multiple corresponding grid index numbers based on multiple point data; wherein, one point data corresponds to one grid index number;
[0040] A processing module is used to assign multiple grid index numbers to multiple grids based on multiple grid index numbers and a predetermined side length; wherein, a grid is constructed based on a grid index number and a corresponding predetermined grid index number, and the predetermined grid index number is generated based on the grid index number and the predetermined side length.
[0041] The aggregation module is used to aggregate multiple grid index numbers from multiple grids to form a map.
[0042] Thirdly, embodiments of the present invention provide a terminal, the terminal including a processor and a memory for storing a computer program capable of running on the processor; wherein, when the processor runs the computer program, it implements the map processing method described in any embodiment of the present invention.
[0043] Fourthly, embodiments of the present invention also provide a computer storage medium containing computer-executable instructions, which are executed by a processor to implement the map processing method described in any embodiment of the present invention.
[0044] In this embodiment of the invention, multiple grid index numbers can be generated based on multiple point data; wherein one point data corresponds to one grid index number; based on the multiple grid index numbers and a predetermined side length, the multiple grid index numbers are assigned to multiple grids; wherein one grid is constructed based on one grid index number and a corresponding predetermined grid index number, and the predetermined grid index number is generated based on the grid index number and the predetermined side length; the multiple grid index numbers from the multiple grids are aggregated to form a map. Thus, this embodiment of the invention does not require pre-constructing grid data, but can directly generate grid index numbers from known point data, and then aggregate the point data into grids according to the grid index numbers to generate a map; thus, it eliminates the need to pre-generate grid data and avoids requiring each point data to traverse the entire grid data for aggregation, thereby improving grid aggregation efficiency and shortening the map construction time. Attached Figure Description
[0045] Figure 1 This is a flowchart illustrating a map processing method provided in an embodiment of the present invention.
[0046] Figure 2This is a schematic diagram of a map aggregation structure provided in an embodiment of the present invention.
[0047] Figure 3 This is a schematic flowchart of another map processing method provided in an embodiment of the present invention.
[0048] Figure 4 This is a flowchart illustrating another map processing method provided in an embodiment of the present invention.
[0049] Figure 5 This is a schematic diagram of latitude and longitude data for a point data embodiment of the present invention.
[0050] Figure 6 This is a schematic diagram illustrating the distances of point data on meridians and parallels provided in an embodiment of the present invention.
[0051] Figure 7 This is a schematic diagram of the structure of a map processing device provided in an embodiment of the present invention;
[0052] Figure 8 This is a schematic diagram of the hardware structure of a terminal provided in an embodiment of the present invention. Detailed Implementation
[0053] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0054] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustrative purposes and has no specific meaning in itself. Therefore, "module," "part," or "unit" may be used interchangeably. Furthermore, in the following description, the use of prefixes such as "first" or "second" to identify information is solely for the purpose of illustrative purposes and has no specific meaning in itself. Additionally, in the following description, "a plurality of" refers to two or more; "multiple types" refers to two or more kinds.
[0055] like Figure 1 As shown, this embodiment of the invention provides a map processing method, including the following steps:
[0056] Step S11: Generate multiple corresponding grid index numbers based on multiple point data; wherein, one point data corresponds to one grid index number;
[0057] Step S12: Based on the multiple grid index numbers and the predetermined side length, assign the multiple grid index numbers to multiple grids; wherein, a grid is constructed based on a grid index number and a corresponding predetermined grid index number, and the predetermined grid index number is generated based on the grid index number and the predetermined side length;
[0058] Step S13: Aggregate the grid index numbers from the multiple grids to form a map.
[0059] The map processing method provided in this embodiment of the invention can be executed by a terminal; the terminal can be any type of mobile terminal or fixed terminal. For example, the terminal can be, but is not limited to, at least one of the following: mobile phone, computer, server, medical device, industrial equipment, and / or wearable device, etc. Here, the map can be a map heatmap or a heat map.
[0060] In this embodiment of the invention, "multiple" refers to two or more points. In one embodiment, multiple point data includes N point data, where N is an integer greater than 1.
[0061] In one embodiment, a point data corresponds to a grid index number and a predetermined grid index number; the predetermined grid index number is generated based on the grid index number and a predetermined side length.
[0062] In one embodiment, a point data includes a longitude coordinate and a latitude coordinate; or, a point data includes an x-coordinate and a y-coordinate.
[0063] Of course, in other embodiments, point data can also be represented by any known type of coordinates, and there is no restriction on the specific coordinates of the point data.
[0064] In one embodiment, the method includes: determining a predetermined side length. Here, the predetermined side length can be determined based on any feasible method; for example, the predetermined side length can be determined based on user input; or, for example, the predetermined side length can be determined based on historical experience data; or, for example, the predetermined side length can be determined based on a scaling factor; no limitation is placed on the method of determining the predetermined side length.
[0065] In another embodiment, the method includes: adjusting a predetermined side length based on a reduction ratio. Here, the reduction ratio refers to the proportion or multiple by which the map needs to be reduced to reflect the actual geographical location. The length of the predetermined side length is positively correlated with the reduction ratio; for example, the smaller the proportion by which the map needs to be reduced to reflect the actual geographical location, the larger the predetermined side length is determined; or, the larger the proportion by which the map needs to be reduced to reflect the actual geographical location, the larger the predetermined side length is determined.
[0066] Thus, embodiments of the present invention can dynamically adjust the predetermined side length, greatly improving the efficiency of grid convergence and the flexibility of use. Furthermore, embodiments of the present invention can adaptively adjust the predetermined side length according to the scale by which the map needs to be scaled down to the actual geographical location, thereby obtaining a map with a more reasonable layout.
[0067] In one embodiment, a grid is constructed based on a grid index number and a predetermined side length. For example, such as... Figure 2 As shown, a grid can be defined by constructing a square based on the grid index number of the point data and a predetermined side length. The two vertices of this grid, such as the lower left and upper right vertices, can be the grid index number of the point data and the predetermined grid index number, respectively. Here, the predetermined side length can be the length or width of the grid, or it can be both the length and width of the grid. If the predetermined side length is the width of the grid, the width of the grid can be the actual distance corresponding to a predetermined latitude (e.g., a parallel of latitude 1 degree apart from a meridian).
[0068] In one embodiment, step S13 may be: aggregating multiple grids to generate a map, wherein the multiple grids include corresponding grid index numbers. Thus, after assigning multiple grid index numbers to their corresponding grids, the grids are aggregated into a map, at which point the multiple grid index numbers are included in the map, meaning the corresponding point data is assigned to the map.
[0069] In this embodiment of the invention, the terminal generates multiple corresponding grid index numbers based on multiple point data; wherein, one point data corresponds to one grid index number; based on the multiple grid index numbers and a predetermined side length, the multiple grid index numbers are assigned to multiple grids; wherein, one grid is constructed based on one grid index number and a corresponding predetermined grid index number, and the predetermined grid index number is generated based on the grid index number and the predetermined side length; the multiple grid index numbers from the multiple grids are aggregated to form a map. Thus, this embodiment of the invention does not require pre-constructing grid data, but can directly generate grid index numbers from known point data, and then aggregate the point data into grids according to the grid index numbers to generate a map; thus, it eliminates the need to pre-generate grid data and avoids requiring each point data to traverse the entire grid data for aggregation, thereby improving grid aggregation efficiency and shortening the map construction time.
[0070] like Figure 3 As shown, in some embodiments, the plurality of point data includes at least: first point data and second point data;
[0071] Step S11 includes:
[0072] Step S111: Generate a first grid index number based on the first point data and a second grid index number based on the second point data;
[0073] Step S12, which assigns multiple grid index numbers to multiple grids based on multiple grid index numbers and a predetermined side length, includes:
[0074] Step S121: Generate a first predetermined grid index number based on the first grid index number and the predetermined side length;
[0075] Step S122: Determine whether the second grid index number is in the first grid. If so, assign the second grid index number to the first grid. The first grid is constructed based on the first grid index number.
[0076] Step S13 includes:
[0077] Step S131: Combine the first grid index number and the second grid index number in the first grid to form the map that includes at least the first grid.
[0078] Here, before step S122, the method further includes: determining the first grid based on the first grid index number and the first predetermined grid index number. The lower left vertex and the upper right vertex of the first grid can be the first grid index number and the first predetermined grid index number, respectively; the length of the first grid is the predetermined side length.
[0079] In one embodiment, if the second grid index number is in the first grid, then the second point data can be considered to be a point that duplicates the first point data; in this case, assigning the second grid index number to the first grid can be done by retaining the first grid index number of the first point data in the first grid but deleting the second grid index number of the second point data.
[0080] In another embodiment, if the second grid index number is in the first grid, the second point data and the first point data can also be kept in the first grid at the same time; in this case, assigning the second grid index number to the first grid can be done by keeping the first grid index number of the first point data and the second grid index number of the second point data in the first grid.
[0081] Thus, in this embodiment of the invention, when the second point data's second grid index number is in the first grid, the second point data can be assigned to the first grid, thereby aggregating it into the first point data and the second point data; or the second point data can be aggregated into the first grid as a duplicate of the first point data. This allows for the aggregation of point data. Of course, the second point data can be any number of point data points, thus enabling the aggregation of multiple point data points.
[0082] like Figure 4As shown, in some embodiments, step S12, based on multiple grid index numbers and a predetermined side length, assigns multiple grid index numbers to multiple grids, including:
[0083] Step S123: If it is determined that the second grid index number is not in the first grid, the second grid index number of the second point data is re-determined based on the first grid index number and the predetermined side length or based on the first predetermined grid index number and the predetermined side length;
[0084] Step S124: Assign the second grid index number to the second grid; wherein, the second grid is constructed based on the re-determined second grid index number and the second predetermined grid index number, and the second predetermined grid index number is generated based on the re-determined second grid index number and the predetermined side length;
[0085] Step S13 includes:
[0086] Step S132: Combine the first grid index number in the first grid and the second grid index number in the second grid to form the map that includes at least the first grid and the second grid.
[0087] Here, before step S124, the method further includes: constructing a second grid based on the newly determined second grid index number and the second predetermined grid index number. Here, the lower left vertex and the upper right vertex of the second grid can be the second grid index number and the second predetermined grid index number, respectively; the length of the second grid is the predetermined side length.
[0088] In one embodiment, step S23, re-determining the second grid index number of the second point data based on the first grid index number and the predetermined side length, or based on the first predetermined grid index number and the predetermined side length, includes:
[0089] If the first longitude coordinate of the second point data is in the first direction of the first grid, the second grid index number of the second point data is re-determined based on the first grid index and the predetermined side length;
[0090] or,
[0091] If the first longitude coordinate of the second point data is in the second direction of the first grid, the second grid index number of the second point data is re-determined based on the first predetermined grid index and the predetermined side length.
[0092] Here, the first direction is the direction to the left and / or bottom of the first grid; if the first direction is the direction to the left of the first grid, the second grid index number is re-determined based on the first grid index number and a predetermined distance to the left; or, if the first direction is the direction to the bottom of the first grid, the second grid index number is re-determined based on the first grid index number and a predetermined distance to the bottom.
[0093] Here, the second direction is the direction to the right and / or the top of the first grid; if the first direction is the direction to the right of the first grid, the second grid index number is re-determined based on the first predetermined grid index number and the distance of the predetermined side length to the right; or, if the second direction is the direction to the top of the first grid, the second grid index number is re-determined based on the first predetermined grid index number and the distance of the predetermined side length upward.
[0094] In another embodiment, step S123: If it is determined that the second grid index number is not in the first grid, the second grid index number is re-determined. Here, re-determining the second grid index number may be: determining a predetermined number of predetermined side lengths based on the distance between the first grid index number and the second grid index number; and re-determining the second grid index number based on the first grid index number and the predetermined number of predetermined side lengths. For example, if the distance between the first grid index number and the second grid index number in the X coordinate is 3 predetermined side lengths, then the second grid index number is re-determined based on the first grid index number and 3 predetermined side lengths; in this case, the re-determined second grid index number is the same as the second grid index number previously determined based on the second point data. Alternatively, if the distance between the first grid index number and the second grid index number is 2.3 predetermined side lengths (i.e., less than the predetermined number of predetermined side lengths), then the second grid index number is re-determined based on the first grid index number and 3 predetermined side lengths (i.e., the predetermined number of predetermined side lengths); in this case, the re-determined second grid index number is not the same as the second grid index number previously determined based on the second point data.
[0095] Thus, in this embodiment of the invention, when the second grid index number of the second point data is not in the first grid, the second point data can be assigned to the second grid, which is a grid that is a predetermined number of predetermined side lengths away from the first grid; thereby, it can be aggregated into the first point data and the second point data. In this way, the aggregation of point data can be realized.
[0096] Of course, the second data point can be any number of data points. In this way, multiple data points can be aggregated sequentially into the same grid as the previous data point or into a grid with a predetermined side length that is a predetermined distance away, thereby achieving accurate aggregation of multiple data points.
[0097] In some embodiments, the method includes:
[0098] Based on the predetermined side length and predetermined latitude distance, the longitude difference is determined; wherein, the predetermined latitude distance is determined by the predetermined longitude distance and the latitude of the point data, and the point data includes the first point data;
[0099] The latitude difference is determined based on the predetermined side length and the predetermined longitude distance;
[0100] The step S111, which generates a first grid index number based on the first point data, includes:
[0101] Based on the longitude of the first point data and the longitude difference, determine the first longitude coordinates of the first point data;
[0102] Based on the latitude of the first point data and the latitude difference, determine the first latitude coordinates of the first point data;
[0103] Based on the first longitude coordinates and the first latitude coordinates, determine the first grid index number of the first point data.
[0104] In this embodiment of the invention, the longitude difference and / or latitude difference corresponding to each data point can be determined. Here, within the same predetermined side length, the latitude difference corresponding to each data point can be the same; the longitude difference of each data point is different, and the longitude difference of each data point is related to the latitude of that data point. The magnitude of the longitude difference of each data point is inversely correlated with the magnitude of the latitude of that data point.
[0105] In one embodiment, determining the first longitude coordinate of the first point data based on the longitude of the first point data and the longitude difference can be achieved by dividing the longitude of the first point data by a longitude difference that is rounded down, and then multiplying by another longitude difference that is rounded down. Here, the first longitude coordinate can also be a value rounded down. The first longitude coordinate can also be the longitude of the first point data multiplied by a magnification factor. This magnification factor can be the distance of 1 degree of longitude on the map relative to the actual distance of 1 degree of longitude on Earth.
[0106] In one embodiment, determining the first latitude coordinate of the first point data based on the latitude and the latitude difference can be achieved by dividing the latitude of the first point data by a latitude difference that is rounded down, and then multiplying by another latitude difference that is rounded down, to determine the second longitude coordinate of the first point data. Here, the first latitude coordinate can also be the latitude difference that is rounded down. The first latitude coordinate can also be the latitude of the first point data multiplied by a magnification factor.
[0107] In other embodiments, the first longitude coordinates and / or first latitude coordinates of other point data (e.g., all other point data in a plurality of point data except the first point data) can be determined based on the method for determining the first longitude coordinates and / or first latitude coordinates of the first point data.
[0108] In one embodiment, determining the first grid index number of the first point data based on the first longitude coordinates and the first latitude coordinates may be: aggregating the first longitude coordinates and the first latitude coordinates of the first point data to form the first grid index number of the first point data.
[0109] In this embodiment of the invention, the first longitude coordinates and / or first latitude coordinates of each point data can be accurately determined based on the difference between the longitude and / or latitude of each point data and the difference between the longitude and / or latitude determined by a predetermined side length, that is, the first grid index number of each point data can be accurately determined.
[0110] In some embodiments, step S121 includes:
[0111] The second longitude coordinate of the first point data is determined based on the sum of the first longitude coordinates and the longitude difference of the first point data.
[0112] The second latitude coordinate of the first point data is determined based on the sum of the first latitude coordinate and the latitude difference of the first point data.
[0113] Based on the second longitude coordinates and the second latitude coordinates, the first predetermined grid index number of the first point data is determined.
[0114] Here, the first grid index number of the first data point is the coordinate of the lower left corner of the first grid, and the first predetermined grid index number of the first data point is the coordinate of the upper right corner of the first grid.
[0115] In some other embodiments, step S121 includes:
[0116] The second longitude coordinate of the first point data is determined based on the difference between the first longitude coordinate of the first point data and the longitude difference value of the first point data;
[0117] The second latitude coordinate of the first point data is determined based on the difference between the first latitude coordinate of the first point data and the latitude difference value of the first point data;
[0118] Based on the second longitude coordinates and the second latitude coordinates, the first predetermined grid index number of the first point data is determined.
[0119] Here, the first grid index number of the first data point is the coordinate of the upper right corner of the grid, and the first predetermined grid index number of the first data point is the coordinate of the lower left corner of the first grid.
[0120] In this embodiment of the invention, the predetermined grid index number of each point data can be determined uniformly by using the sum of the grid index number and the longitude difference and / or latitude difference, or uniformly by using the difference between the grid index number and the longitude difference and / or latitude difference.
[0121] Of course, in other embodiments, the second longitude coordinates and / or second latitude coordinates of other point data (e.g., all other point data in a plurality of point data except for the first point data) can be determined based on the method for determining the second longitude coordinates and / or second latitude coordinates of the first point data.
[0122] In one embodiment, determining the first predetermined grid index number of the first point data based on the second longitude coordinates and the second latitude coordinates may be: aggregating the second longitude coordinates and the second latitude coordinates of the first point data to form the first predetermined grid index number of the first point data.
[0123] In this embodiment of the invention, the predetermined grid index number of each point data can be accurately determined by the grid index number of each point data and the longitude difference and / or latitude difference determined by the predetermined side length, thereby accurately determining the grid corresponding to each point data.
[0124] In this invention, the lower left or upper right corner coordinates of each grid in the generated map can be the data of each point.
[0125] In some embodiments, step S13 includes:
[0126] If multiple grid index numbers are in the same grid, determine any one of the multiple grid index numbers in the grid as the target grid index number;
[0127] A map is formed based on the target grid index number among the multiple grids.
[0128] In one embodiment, determining any one of the multiple grid index numbers in the grid as the target grid index number can be:
[0129] The target grid index number is determined from among multiple grid index numbers in the grid that corresponds to the lower left vertex of the grid.
[0130] Alternatively, the target grid index number can be determined from among multiple grid index numbers in the grid, the grid index number corresponding to the top right vertex of the grid.
[0131] Alternatively, the target grid index number can be determined from among multiple grid index numbers in the grid that is at a predetermined distance from the bottom left vertex of the grid.
[0132] Alternatively, the grid index number that is at a predetermined distance from the top right corner vertex of the grid can be identified as the target grid index number among multiple grid index numbers in the grid;
[0133] The predetermined distance is a distance that is less than or equal to half the predetermined side length.
[0134] In this embodiment of the invention, duplicate point data or grid index numbers of at least one other point data that is very close to a point data can be deleted. That is, the grid index numbers in the grid can be deduplicated, thereby simplifying the calculation and improving the efficiency of the converged map while ensuring the converged result.
[0135] Furthermore, in this embodiment of the invention, the grid index number that is close to the lower left or lower right corner of the grid can be uniformly retained, thereby further improving the accuracy of the convergence results.
[0136] To further explain any embodiment of the present invention, a specific embodiment is provided below.
[0137] This invention provides a map processing method, executed by a terminal, comprising the following steps:
[0138] Step S21: The terminal determines the parameters of the data at each point;
[0139] Here, the point data can be multiple point data points as described in the above embodiments. This point data includes first point data and second point data. The parameter can be the actual distance of the point data points along a meridian and / or parallel.
[0140] For example, the side length of the grid, i.e., the predetermined side length in the above embodiment, is L; the unit of L is meters. The longitude of the point data is represented by "lon" and the latitude of the point data is represented by "lat". The longitude difference of the grid with the predetermined side length L in this area is represented by "lon_dif".
[0141] According to the division of Earth's latitude and longitude, it can be like... Figure 5 As shown, the length of the latitude segment is constant between each equal division of latitude; for example, segments A and B are of equal length. Between each equal division of longitude, the length of the latitude segment decreases from the equator towards the poles; for example, segments C and D are of different lengths. Based on the Earth's circumference of 40,076 kilometers, the distance corresponding to 1 degree of longitude is... Kilometers; on a parallel of latitude, 1 degree corresponds to a distance of 111 × cosθ kilometers; where θ is the latitude of that parallel. Figure 5 In this context, dx and dy can represent the difference between predetermined longitudes and the difference between predetermined latitudes, respectively.
[0142] For example, such as Figure 6 As shown, the meridians where A' and B' are located are α°, and the meridian where C' is located is (α+1)°; and the parallels where A' and C' are located are... The latitude where B' is located is On a line of latitude, if the actual distance to B' is 111 kilometers, then the actual distance to A' is... km.
[0143] Step S22: The terminal determines the grid index number of each point's data;
[0144] Here, the terminal converts the predetermined side length L into a longitude difference: Where θ is the latitude of the parallel where the point data is located; the predetermined side length L is converted into a latitude difference value: The terminal determines the first longitude and first latitude coordinates of the point data, where the first longitude coordinate is the lower left X-coordinate and the first latitude coordinate is the lower left Y-coordinate (here, the lower left X-coordinate and lower left Y-coordinate are multiplied by 100,000 to convert the order of magnitude to meters):
[0145] X-coordinate (bottom left):
[0146]
[0147] Y-coordinate (bottom left corner):
[0148] Where θ=Y zuoxia ×0.00001; “floor” is the floor function. Here, dividing the first longitude coordinate of a point data point by the actual distance to the meridian and then multiplying it by the floor function is equivalent to dividing the actual distance to the meridian; and / or, dividing the first latitude coordinate of a point data point by the actual distance to the latitude and then multiplying it by the floor function is equivalent to dividing the actual distance to the latitude.
[0149] The terminal is based on the X and Y coordinates of the lower left corner. zuoxia and the Y-coordinate of the lower left corner zuoxia Determine the grid index number: index_grid = X coordinate (bottom left corner) | Y coordinate (bottom left corner), that is, index_grid = Y zuoxia |Y zuoxia .
[0150] Step S23: The terminal determines the predetermined grid index number corresponding to the grid index number of each point data;
[0151] Here, the terminal determines the second longitude coordinate of the point data based on the first longitude coordinate and the predetermined side length. Determining the second longitude coordinate of the point data based on the first longitude coordinate and the predetermined side length can be achieved by summing the first longitude coordinate and the longitude difference. Similarly, the terminal determines the second latitude coordinate of the point data based on the first latitude coordinate and the predetermined side length. This can also be achieved by summing the first latitude coordinate and the latitude difference. The second longitude coordinate is the upper right X-coordinate, and the second latitude coordinate is the upper right Y-coordinate (here, the upper right X-coordinate and upper right Y-coordinate are multiplied by 100,000 to convert the order of magnitude to meters).
[0152] X-coordinate (top right corner):
[0153] Y-coordinate (top right corner):
[0154] The terminal is based on the X and Y coordinates of the upper right corner. youshan and the Y-coordinate of the upper right corner youshan Determine the grid index number: index_grid' = X coordinate (top right corner) | Y coordinate (top right corner), that is, index_grid' = Y youshang |Y youshang .
[0155] In an optional embodiment, the method includes step S24: the terminal determines the latitude and longitude of the lower left X coordinate, lower left Y coordinate, upper right X coordinate, and upper right Y coordinate of each point data;
[0156] The X-coordinate of the bottom left corner, i.e., the longitude of the bottom left corner: lon_lb = X zuoxia ×0.00001;
[0157] The bottom-left Y-coordinate, i.e., the latitude of the bottom-left corner: lat_lb = Y zuoxia ×0.00001;
[0158] The X-coordinate of the upper right corner, i.e., the longitude of the upper right corner: lon_rt = X youshang ×0.00001;
[0159] The Y-coordinate of the top right corner, i.e., the latitude of the top right corner: lat_rt = Y youshang ×0.00001.
[0160] Step S25: The terminal determines the grid index number based on the point data and the predetermined grid index number to generate a grid with a predetermined side length; a map is generated based on each grid.
[0161] Here, the terminal generates a grid of predetermined side length L using the grid index number corresponding to the lower left corner coordinates (including the lower left X and Y coordinates) and the upper right corner coordinates (including the lower right X and Y coordinates). For example, see again... Figure 2 For example, the first grid (e.g., grid 1 for the first point data) is a grid with a predetermined side length L. This grid 1 is constructed based on the grid index number and the predetermined grid index number of the first point data. The terminal determines which grid contains the other point data besides the first point data. For example, it determines whether the second point data is in the first grid. If it is, it determines that the second point data is a duplicate of the first point data. If it is not, it determines the second grid based on the grid index number corresponding to the lower left corner coordinate and the predetermined grid index number corresponding to the upper right corner coordinate of the second point data. The terminal aggregates the grid index numbers from all grids to generate a map.
[0162] For example, an experiment was conducted using a predetermined side length L of 800 meters. Based on the algorithm described above, a SQL statement was written to generate the aggregated results of the grid. The grid data was created using the `st_geomfromtext` function of the PostGIS plugin in PostgreSQL. The algorithm calculated the aggregated results of multiple grids. Measuring the predetermined side length of the grid using a length measurement tool resulted in minimal error, indicating accurate aggregation calculation. To evaluate the grid aggregation efficiency, a 1000m by 1000m grid was used as a comparison. It was found that the algorithm of this invention improves aggregation efficiency by approximately 59% compared to traditional algorithms.
[0163] In this embodiment of the invention, there is no need to construct grid data in advance; only the predetermined side length of the grid needs to be determined beforehand. The grid data is dynamically generated during the aggregation calculation process. This eliminates the need for each point to traverse the entire grid data; instead, the aggregation result can be obtained directly by summarizing duplicate point data in the grid, thereby improving grid aggregation efficiency and shortening map construction time. Furthermore, the predetermined side length of the grid can be dynamically adjusted, allowing for greater flexibility in setting the grid size.
[0164] It should be noted that the description of the map processing device below is similar to the description of the map processing method above, and the beneficial effects of the same method will not be repeated. For technical details not disclosed in the embodiments of the map processing device of the present invention, please refer to the description of the embodiments of the map processing method of the present invention.
[0165] like Figure 7 As shown, an embodiment of the present invention provides a map processing device, including:
[0166] The generation module 41 is used to generate multiple corresponding grid index numbers based on multiple point data; wherein, one point data corresponds to one grid index number;
[0167] Processing module 42 is used to assign multiple grid index numbers to multiple grids based on multiple grid index numbers and a predetermined side length; wherein, a grid is constructed based on a grid index number and a corresponding predetermined grid index number, and the predetermined grid index number is generated based on the grid index number and the predetermined side length;
[0168] The aggregation module 43 is used to aggregate multiple grid index numbers from multiple grids to form a map.
[0169] The map processing device provided in this embodiment of the invention can be a terminal.
[0170] In some embodiments, the plurality of point data includes at least: first point data and second point data;
[0171] The generation module 41 is used to generate a first grid index number based on the first point data and to generate a second grid index number based on the second point data.
[0172] The processing module 42 is used to generate a first predetermined grid index number based on the first grid index number and the predetermined side length;
[0173] The processing module 42 is further configured to determine whether the second grid index number is in the first grid, and if so, to assign the second grid index number to the first grid; wherein the first grid is constructed based on the first grid index number and the first grid index number.
[0174] The aggregation module 43 is used to aggregate the first grid index number and the second grid index number in the first grid to form the map that includes at least the first grid.
[0175] In some embodiments, the processing module 42 is configured to, if it is determined that the second grid index number is not in the first grid, re-determine the second grid index number of the second point data based on the first grid index number and the predetermined side length or based on the first predetermined grid index number and the predetermined side length;
[0176] The processing module 42 is further configured to assign the second grid index number to the second grid; wherein the second grid is constructed based on the re-determined second grid index number and the second predetermined grid index number, and the second predetermined grid index number is generated based on the re-determined second grid index number and the predetermined side length;
[0177] The aggregation module 43 is used to aggregate the first grid index number in the first grid and the second grid index number in the second grid to form the map that includes at least the first grid and the second grid.
[0178] In some embodiments, the processing module 42 is configured to determine a longitude difference based on the predetermined side length and the predetermined latitude distance; wherein the predetermined latitude distance is determined by the predetermined longitude distance and the latitude of the point data, and the point data includes the first point data;
[0179] The processing module 42 is used to determine the latitude difference based on the predetermined side length and the predetermined longitude distance;
[0180] The generation module 41 is used to determine the first longitude coordinates of the first point data based on the longitude of the first point data and the longitude difference;
[0181] The generation module 41 is used to determine the first latitude coordinates of the first point data based on the latitude of the first point data and the latitude difference.
[0182] The generation module 41 is used to determine the first grid index number of the first point data based on the first longitude coordinates and the first latitude coordinates.
[0183] In some embodiments, the processing module 42 is configured to determine the second longitude coordinates of the first point data based on the sum of the first longitude coordinates of the first point data and the longitude difference of the first point data;
[0184] The processing module 42 is used to determine the second latitude coordinate of the first point data based on the sum of the first latitude coordinate of the first point data and the latitude difference of the first point data;
[0185] The processing module 42 is further configured to determine the first predetermined grid index number of the first point data based on the second longitude coordinates and the second latitude coordinates.
[0186] In some embodiments, the aggregation module 43 is configured to determine any one of the multiple grid index numbers in the same grid as the target grid index number if multiple grid index numbers are in the same grid;
[0187] The aggregation module 43 is also used to form a map based on the target grid index number in the plurality of grids.
[0188] In some embodiments, the processing module 42 is configured to adjust the predetermined side length based on the scaling ratio.
[0189] like Figure 8 As shown, this embodiment of the invention also provides a terminal, which includes a processor 61 and a memory 62 for storing computer programs that can run on the processor 61; wherein, when the processor 61 runs the computer program, it implements the map processing method of any embodiment of the invention.
[0190] In some embodiments of the present invention, the memory may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory may be random access memory (RAM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate Synchronous DRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0191] The processor may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the processor's hardware or by software instructions. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0192] In some embodiments, the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the invention, or combinations thereof.
[0193] For software implementation, the techniques described herein can be achieved through modules (e.g., procedures, functions, etc.) that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented within the processor or externally.
[0194] Another embodiment of the present invention provides a computer storage medium storing an executable program, which, when executed by a processor, can implement the steps of the map processing method of any embodiment of the present invention.
[0195] In some embodiments, the computer storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0196] It should be noted that the technical solutions described in the embodiments of the present invention can be combined arbitrarily without conflict.
[0197] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A map processing method, characterized in that, The method includes: Multiple grid index numbers are generated based on multiple point data; wherein, one point data corresponds to one grid index number; the multiple point data includes at least: first point data and second point data; wherein, generating multiple grid index numbers based on multiple point data includes: generating a first grid index number based on the first point data and generating a second grid index number based on the second point data; Based on multiple grid index numbers and predetermined side lengths, the multiple grid index numbers are assigned to multiple grids; wherein, each grid is constructed based on one grid index number and a corresponding predetermined grid index number, and the predetermined grid index number is generated based on the grid index number and the predetermined side length; wherein, assigning multiple grid index numbers to multiple grids based on multiple grid index numbers and predetermined side lengths includes: generating a first predetermined grid index number based on the first grid index number and the predetermined side length; determining whether the second grid index number is in the first grid, and if so, assigning the second grid index number to the first grid; wherein the first grid is constructed based on the first grid index number and the first predetermined grid index number; if it is determined that the second grid index number is not in the first grid, re-determining the second grid index number of the second point data based on the first grid index number and the predetermined side length or based on the first predetermined grid index number and the predetermined side length; assigning the second grid index number to a second grid; wherein the second grid is constructed based on the re-determined second grid index number and the second predetermined grid index number, and the second predetermined grid index number is generated based on the re-determined second grid index number and the predetermined side length; A map is formed by aggregating multiple grid index numbers from multiple grids; wherein aggregating multiple grid index numbers from multiple grids to form a map includes: aggregating the first grid index number and the second grid index number from the first grid to form a map that includes at least the first grid; or aggregating the first grid index number from the first grid and the second grid index number from the second grid to form a map that includes at least the first grid and the second grid.
2. The method according to claim 1, characterized in that, The method includes: Based on the predetermined side length and predetermined latitude distance, the longitude difference is determined; wherein, the predetermined latitude distance is determined by the predetermined longitude distance and the latitude of the point data, and the point data includes the first point data; The latitude difference is determined based on the predetermined side length and the predetermined longitude distance; The step of generating the first grid index number based on the first point data includes: Based on the longitude of the first point data and the longitude difference, determine the first longitude coordinates of the first point data; Based on the latitude of the first point data and the latitude difference, determine the first latitude coordinates of the first point data; Based on the first longitude coordinates and the first latitude coordinates, determine the first grid index number of the first point data.
3. The method according to claim 2, characterized in that, The step of generating a first predetermined grid index number based on the first grid index number and the predetermined side length includes: The second longitude coordinate of the first point data is determined based on the sum of the first longitude coordinates and the longitude difference of the first point data. The second latitude coordinate of the first point data is determined based on the sum of the first latitude coordinate and the latitude difference of the first point data. Based on the second longitude coordinates and the second latitude coordinates, the first predetermined grid index number of the first point data is determined.
4. The method according to claim 1 or 2, characterized in that, The aggregation of multiple grid index numbers from multiple grids to form a map includes: If multiple grid index numbers are in the same grid, determine any one of the multiple grid index numbers in the grid as the target grid index number; A map is formed based on the target grid index number among the multiple grids.
5. The method according to claim 1 or 2, characterized in that, The method further includes: Adjust the predetermined side length based on the scaling ratio; wherein, the scaling ratio refers to the ratio or multiple by which the map needs to be scaled down to the actual geographical location.
6. A map processing device, characterized in that, The device includes: A generation module is used to generate multiple corresponding grid index numbers based on multiple point data; wherein, one point data corresponds to one grid index number; the multiple point data includes at least: first point data and second point data; wherein, the generation module is specifically used to generate a first grid index number based on the first point data and generate a second grid index number based on the second point data; A processing module is configured to assign multiple grid index numbers to multiple grids based on multiple grid index numbers and a predetermined side length; wherein, a grid is constructed based on a grid index number and a corresponding predetermined grid index number, and the predetermined grid index number is generated based on the grid index number and the predetermined side length; wherein, the processing module is specifically configured to generate a first predetermined grid index number based on the first grid index number and the predetermined side length; determine whether the second grid index number is in the first grid, and if so, assign the second grid index number to the first grid; wherein the first grid is constructed based on the first grid index number and the first predetermined grid index number; if it is determined that the second grid index number is not in the first grid, re-determine the second grid index number of the second point data based on the first grid index number and the predetermined side length or based on the first predetermined grid index number and the predetermined side length; assign the second grid index number to the second grid; wherein the second grid is constructed based on the re-determined second grid index number and the second predetermined grid index number, and the second predetermined grid index number is generated based on the re-determined second grid index number and the predetermined side length; A convergence module is used to converge multiple grid index numbers from multiple grids to form a map; wherein, the convergence module is specifically used to: converge the first grid index number and the second grid index number in the first grid to form a map that includes at least the first grid; or, converge the first grid index number in the first grid and the second grid index number in the second grid to form a map that includes at least the first grid and the second grid.
7. A terminal, characterized in that, The terminal includes a processor and a memory for storing a computer program capable of running on the processor; wherein, when the processor runs the computer program, it implements the map processing method according to any one of claims 1 to 5.
8. A computer storage medium, characterized in that, The computer storage medium contains computer-executable instructions, characterized in that the computer-executable instructions are executed by a processor to implement the map processing method according to any one of claims 1 to 5.