A method for thinning vector lines

By traversing the vector lines, determining the connection length and the point to be diluted, and performing the threshold-based dilution processing, solving the problem of deleting the vector line dilution algorithm in the corner area in the prior art, realizing the smoothing of the morphological trend and effective compression of data.

CN118397134BActive Publication Date: 2025-03-28CHINA COAL RES INST +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410574012.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-10
Publication Date
2025-03-28
Estimated Expiration
2044-05-10

AI Technical Summary

Technical Problem

The existing vector line dilution algorithm performs large-scale deletion in the corner area, which may lead to huge differences before and after crossing and morphological changes, and the purpose of simplification is not achieved.

Method used

By traversing the vector lines from the starting point, the connection lengths between adjacent points in each group are determined, the dilution point to be drawn is determined based on the connection length, and dilution is performed according to the connection position of the dilution point to be drawn until the connection line with the shortest connecting line length is greater than the preset dilution threshold.

Benefits of technology

The vector line has a smooth morphological trend. By reasonably setting thresholds and generating new nodes, the vector line has a slow morphological trend, avoiding the data after dilution and the data has undergone sudden changes or drastic changes, and maintaining the overall shape of the original data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118397134B_ABST
    Figure CN118397134B_ABST
Patent Text Reader

Abstract

The present disclosure proposes a vector line thinning method, which relates to the field of data processing technology, including: traversing the vector line from a starting point to determine the line lengths of the lines between each group of adjacent points on the vector line; determining the points to be thinned out from the groups of adjacent points based on the lengths of each line; thinning out the vector line according to the positions of the lines corresponding to the points to be thinned out in the vector line; and determining that the thinning out of the vector line is completed in response to determining that the line with the shortest line length in the vector line is greater than a preset thinning threshold. In this way, the morphological trend can be kept smooth, and by reasonably setting the threshold and generating new nodes when eliminating the thinned out points, it can be ensured that the morphological change trend of the vector line is slow, which means that the data after thinning will not undergo mutations or sharp changes, and the overall morphology of the original data is maintained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a vector line thinning method. Background Art

[0002] With the explosive development of information technology, the types and storage scale of data have exploded exponentially, and the massive data has also brought huge challenges to map visualization. Therefore, how to perform compression operations such as thinning on basic data while ensuring data quality, and then improve the efficiency of data storage, transmission, loading and visualization rendering, has become a problem that needs to be solved urgently.

[0003] Vector data is one of the important types of basic geographic data. The basic types include vector points, vector lines, and vector surface data. Vector line data can be seen as the result of connecting multiple vector points in sequence, or as the boundary of vector surface data. Therefore, taking vector line data as the research focus of the thinning method has important reference significance for studying the compression methods of vector point and surface data.

[0004] Vector line data is widely used in the fields of roads, pipelines, administrative boundaries, rivers, etc. Generally, the corner area of ​​the vector line will show the characteristics of dense point data. Appropriate thinning processing here will not affect the overall quality of the line data. On the contrary, it can greatly simplify the vector line data and improve the efficiency of the use of vector line data. At present, the most widely used thinning algorithms are Douglas-Peucker method. The core of this method is to retain key data nodes and iteratively remove the redundancy of inflection points by comparing the vertical distance; Visvalingam-Whyatt method, which compares the triangle area formed by continuous inflection points to determine whether to remove the intermediate nodes; the key bend method retains important bend areas and simplifies non-important areas.

[0005] The first two methods will delete large areas in the corner area, and even cause intersections, and the shape changes before and after are very different. Although the key bend retention method takes this situation into consideration, the thinning result is not much different from the original, and the purpose of simplification is not achieved. Summary of the invention

[0006] The present disclosure aims to solve one of the technical problems in the related art at least to some extent.

[0007] The first aspect of the present disclosure provides a method for thinning out vector lines, including:

[0008] Traversing the vector line from the starting point to determine the length of the connection line between each group of adjacent points on the vector line;

[0009] Based on the lengths of the respective connecting lines, determining the points to be thinned out from the respective groups of adjacent points;

[0010] Thinning out the vector line according to the position of the connecting line corresponding to the to-be-thinned point in the vector line;

[0011] In response to determining that the link with the shortest link length in the vector lines is greater than a preset thinning threshold, it is determined that the thinning of the vector lines is completed.

[0012] The second aspect of the present disclosure provides a vector line thinning device, including:

[0013] A first determining module, used to traverse the vector line from the starting point to determine the length of the connection line between each group of adjacent points on the vector line;

[0014] A second determination module is used to determine the points to be thinned out from the groups of adjacent points based on the lengths of the respective connecting lines;

[0015] A thinning module, used for thinning out the vector line according to the position of the connecting line corresponding to the to-be-thinned point in the vector line;

[0016] The third determining module is configured to determine that the thinning of the vector lines is completed in response to determining that the line with the shortest line length in the vector lines is greater than a preset thinning threshold.

[0017] The third aspect of the present disclosure proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the vector line thinning method proposed in the first aspect of the present disclosure is implemented.

[0018] The fourth aspect embodiment of the present disclosure proposes a non-temporary computer-readable storage medium storing a computer program, which, when executed by a processor, implements the vector line thinning method proposed in the first aspect embodiment of the present disclosure.

[0019] The vector line thinning method, device and electronic device provided by the present disclosure have the following beneficial effects:

[0020] In the disclosed embodiment, the vector line is first traversed from the starting point to determine the length of the connection lines between each group of adjacent points on the vector line, and then the points to be thinned out are determined from each group of adjacent points based on the lengths of each connection line, and then the vector line is thinned out according to the positions of the connection lines corresponding to the points to be thinned out in the vector line, and finally, in response to determining that the line with the shortest connection length in the vector line is greater than a preset thinning threshold, it is determined that the thinning out of the vector line is completed. In this way, the morphological trend can be kept smooth, and by reasonably setting the threshold and generating new nodes when eliminating the thinned points, it can be ensured that the morphological change trend of the vector line is slow, which means that the data after thinning will not undergo mutations or drastic changes, and the overall morphology of the original data is maintained. Since each thinning out takes into account the morphological change trend and the way of generating new nodes, the relative difference of each thinning out result will be minimized.

[0021] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0023] Figure 1 A schematic diagram of a process of thinning out a vector line provided by an embodiment of the present disclosure;

[0024] Figure 2 This is a schematic diagram of the first type of thinning proposed in the embodiment of the present disclosure;

[0025] Figure 3 A schematic flow chart of another vector line thinning method provided in an embodiment of the present disclosure;

[0026] Figure 4 This is a second thinning schematic diagram proposed in the embodiment of the present disclosure;

[0027] Figure 5 A schematic flow chart of another vector line thinning method provided in an embodiment of the present disclosure;

[0028] Figure 6 This is a schematic diagram of the third type of thinning proposed in the embodiment of the present disclosure;

[0029] Figure 7 A structural block diagram of a vector line thinning device provided in an embodiment of the present disclosure;

[0030] Figure 8 A block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0031] Embodiments of the present disclosure are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.

[0032] The following describes a method, apparatus, computer device, and storage medium for thinning out vector lines according to an embodiment of the present disclosure with reference to the accompanying drawings.

[0033] It should be noted that the execution subject of the vector line thinning method in the embodiment of the present disclosure is a vector line thinning device, which can be implemented by software and / or hardware, and can be configured in any electronic device.

[0034] Figure 1 A schematic flow chart of a vector line thinning method provided in the first embodiment of the present disclosure.

[0035] like Figure 1 As shown, the vector line thinning method may include the following steps:

[0036] Step 101 , traverse the vector line from the starting point to determine the length of the line between each group of adjacent points on the vector line.

[0037] In computer graphics, vector lines usually refer to Bezier curves or B-spline curves defined by a series of control points. These curves can be used to create smooth curves and surfaces for graphic design.

[0038] For example, there are n points connected in sequence on the vector line, namely A1, A2, A3, A4, A5...An. Among them, point A1 can be used as the starting point and An as the end point. Among them, A1 and A2 are a group of adjacent points, A2 and A3 are a group of adjacent points, A3 and A4 are a group of adjacent points, and An-1 and An are a group of adjacent points.

[0039] Specifically, the length of the line connecting A1 to A2, the length of the line connecting A2 to A3, the length of the line connecting A3 to A4, ... the length of the line connecting An-1 to An in the vector line can be determined.

[0040] As another implementation method, you can first start from the starting point, traverse the consecutive adjacent points on the vector line, and record the shortest connection length and the corresponding adjacent point sequence number. Then, you can set the shortest length to infinity and set the adjacent point sequence number of the shortest side to None, so that any edge found will be shorter than this initial value. After that, you can start from the first point of the vector line and traverse to the second to last point in sequence. For each pair of adjacent points, calculate the distance between them. If the length of the currently calculated edge is shorter than the shortest length recorded, update the shortest length and the adjacent point sequence number of the shortest side to the sequence number of the current pair of adjacent points. Finally, after the traversal is completed, the final shortest length is the shortest connection length on the entire vector line, and the adjacent point sequence number of the shortest side indicates the position of this shortest side. Through this process, the shortest connection length on the entire vector line and the corresponding adjacent point sequence number can be found.

[0041] Step 102, based on the lengths of each link, determine the points to be thinned out from each group of adjacent points.

[0042] Optionally, when the first line length of the line between any group of adjacent points belongs to the minimum value among the line lengths, it is determined whether the first line length is greater than a preset thinning threshold;

[0043] If the length of the first link is greater than the preset thinning threshold, the thinning is terminated;

[0044] If the first line length is less than or equal to the preset thinning threshold, any group of adjacent points corresponding to the first line length is used as the points to be thinned out.

[0045] Among them, thinning (or data compression) refers to reducing the amount of data by deleting redundant information in the data while trying to maintain the overall shape and characteristics of the data. The preset thinning threshold is a parameter used to control the shortest thinning edge length in the thinning process. When the distance between two points is less than the threshold L, one of the points will be deleted, thereby achieving data compression. Therefore, the threshold size determines the degree of thinning. The size of the thinning threshold will directly affect the thinning rate, that is, the density of data retained after compression. Generally speaking, when the threshold is larger, more points will be deleted, resulting in an increase in the thinning rate and a higher degree of data compression; when the threshold is smaller, more points will be retained, the thinning rate is lower, and the data compression is less. Choosing a suitable thinning threshold requires a trade-off, which is to ensure the basic characteristics of the data morphology and to maximize the thinning rate to achieve a suitable data compression effect.

[0046] Among them, the first line length can be the shortest line length among all the line lengths, that is, the minimum value among the lengths of the lines between adjacent points. Specifically, the calculated first line length can be compared with a preset thinning threshold. If the first line length is greater than the preset thinning threshold, it means that the distance between this group of adjacent points is large, and thinning is not required, and the thinning process terminates. If the first line length is less than or equal to the preset thinning threshold, any group of adjacent points corresponding to the first line length is used as the point to be thinned, that is, any point in this group of adjacent points can be used as a retained point for the subsequent thinning process.

[0047] Through such steps, it is possible to dynamically determine whether thinning is required based on the length of the connection between adjacent points, thereby achieving effective data compression.

[0048] For example, if the length of the line from A1 to A2 is the shortest length among all the line lengths, then the length of the line can be used as the first line length, and A1 and A2 can be used as the points to be thinned out.

[0049] Step 103, thinning out the vector lines according to the positions of the connecting lines corresponding to the points to be thinned out in the vector lines.

[0050] Optionally, the points to be thinned out include a first thinned out point and a second thinned out point, each point on the vector line has a corresponding number, and the numbers increase from the starting point to the end point, and the number of the first thinned out point is smaller than the number of the second thinned out point.

[0051] The number of the first thinning point is smaller than the number of the second thinning point, which means that the first thinning point appears before the second thinning point on the vector line.

[0052] As a possible implementation, when thinning out the vector line, when the first thinning point and the second thinning point are not the starting point or the end point, a third thinning point adjacent to the first thinning point and a fourth thinning point adjacent to the second thinning point may be determined, and the number of the third thinning point is smaller than the number of the fourth thinning point;

[0053] Selecting a fifth thinning point on the first connecting line between the first thinning point and the second thinning point, connecting the fifth thinning point and the third thinning point to obtain a second connecting line, and connecting the fifth thinning point and the fourth thinning point to obtain a third connecting line;

[0054] Establishing a first perpendicular line from the first thinning point to the second connecting line to obtain a first line segment, and establishing a second perpendicular line from the second thinning point to the third connecting line to obtain a second line segment;

[0055] determining a sum of the square of the segment length of the first segment and the square of the segment length of the second segment;

[0056] When any fifth thinning point on the first line makes the sum of squares reach a minimum value, any fifth thinning point is determined as a target node;

[0057] The first thinned-out point and the second thinned-out point in the vector line are replaced based on the target node.

[0058] That is to say, you can first determine the first thinning point and the second thinning point, and make sure that they are not the starting point or the end point, and then find the third thinning point adjacent to the first thinning point and the fourth thinning point adjacent to the second thinning point, and make sure that the number of the third thinning point is less than the number of the fourth thinning point. Next, select the fifth thinning point on the first line between the first thinning point and the second thinning point, and then connect it with the third thinning point and the fourth thinning point to form two lines. Establish the first line segment and the second line segment respectively, and calculate the square of their lengths, and calculate the sum of the square of the square of the length of the first line segment and the square of the length of the second line segment. Select a fifth thinning point on the first line so that the above square sum obtains the minimum value, and determine the fifth thinning point as the target node. Finally, replace the first thinning point and the second thinning point in the vector line with the target node.

[0059] Figure 2 This is a first thinning schematic diagram proposed in the embodiment of the present disclosure, such as Figure 2 As shown, P n and P n+1 are the first thinning point and the second thinning point, i.e. the points to be thinned out, P n-1 is the third thinning point, P n+2 is the fourth thinning point, P is the fifth thinning point, P and P n-1 The line between is the second line, P n+2 The line between and P is the third line. n The first line segment corresponding to the first perpendicular line between the first connecting line and the second connecting line is Δh n , P n+1 The second line segment corresponding to the second perpendicular line between the third line and the third line is Δh n+1 . So that Δh n 2 +Δh n+1 2 The fifth thinning point P with the smallest value is the target node. Then, point P can be used to replace P in the vector line. n and P n+1 , so that only P is retained in the vector line n-1 , P and P n+2 .

[0060] Optionally, in response to determining that the line with the shortest line length in the vector lines is less than or equal to a preset thinning threshold, the vector lines continue to be thinned out.

[0061] Optionally, if thinning of vector lines is continued, the above steps S101 to S103 may be repeatedly performed until thinning is completed.

[0062] It should be noted that when it is determined that the shortest line length in the vector lines is less than or equal to the preset thinning threshold, continuing to thin the vector lines means that even if the current shortest line does not exceed the thinning threshold, there is still enough room for further thinning operations to further reduce the data volume and optimize the data shape.

[0063] When continuing to thin out, some strategies can be used to decide which points should be retained, such as:

[0064] Filter by distance: Keep only points that are far enough away to ensure that the points that are retained are as representative of the overall trend as possible.

[0065] Filter by feature points: retain points with special meaning or importance, such as inflection points, extreme points, etc., to maintain the key features of the data.

[0066] Sampling point screening: Through sampling technology, while retaining a sufficient number of points, these points can effectively represent the distribution of the overall data.

[0067] Consider continuity: When retaining points, consider the continuity between points to ensure that the lines between the retained points do not produce obvious mutations or discontinuities.

[0068] Step 104 : in response to determining that the line with the shortest line length in the vector lines is greater than a preset thinning threshold, determining that the thinning of the vector lines is completed.

[0069] It should be noted that when it is determined that the shortest line length in the vector line is greater than the preset thinning threshold, the thinning of the vector line data can be completed. The thinned vector line data maintains the basic form of the original vector line data, and the thinning rate meets user requirements.

[0070] In the disclosed embodiment, the vector line is first traversed from the starting point to determine the length of the line between each group of adjacent points on the vector line, and then based on the length of each line, the point to be thinned is determined from each group of adjacent points, and then the vector line is thinned according to the position of the line corresponding to the point to be thinned in the vector line, and finally, in response to determining that the line with the shortest line length in the vector line is greater than the preset thinning threshold, it is determined that the thinning of the vector line is completed. Thus, the morphological trend can be kept smooth, and by reasonably setting the threshold and generating new nodes when eliminating the thinning points, it can be ensured that the morphological change trend of the vector line is slow, which means that the data after thinning will not have a sudden change or abrupt change, and the overall morphology of the original data is maintained. Since each thinning takes into account the morphological change trend and the way to generate new nodes, the relative difference of each thinning result will be minimized. This means that even in multiple iterations, the difference between the thinning results will be reduced as much as possible, which improves the consistency and stability of the results. By reasonably setting parameters and generating new nodes, the thinning result can retain the skeleton and main structure of the original data. This means that even if thinning is performed, the data can still accurately reflect the main features and morphology of the original data. It supports multiple iterations by setting different thresholds to maximize the thinning rate. This means that while maintaining the data form, it is possible to minimize the redundant information of the data and improve the simplicity and efficiency of the data. This thinning method can maintain the consistency, stability and accuracy of the data on the basis of taking into account both the form and the thinning rate, so that the thinned data is more in line with actual needs and application scenarios. On the basis of maintaining the original form characteristics, the amount of data is reduced by reducing the data nodes to save storage space and improve processing efficiency.

[0071] Figure 3 A schematic flow chart of a vector line thinning method provided in the second embodiment of the present disclosure.

[0072] like Figure 3 As shown, the vector line thinning method may include the following steps:

[0073] Step 201 , traverse the vector line from the starting point to determine the length of the line between each group of adjacent points on the vector line.

[0074] Step 202, based on the lengths of each link, determine the points to be thinned out from each group of adjacent points.

[0075] It should be noted that the specific implementation of steps 201 - 202 may refer to the above embodiment and will not be described in detail here.

[0076] Step 203, when the first thinning point is used as the starting point, a sixth thinning point is selected on the first connecting line between the first thinning point and the second thinning point, and a seventh thinning point corresponding to the second thinning point is determined.

[0077] Figure 4 This is a second thinning schematic diagram proposed in the embodiment of the present disclosure, such as Figure 4 As shown, P n and P n+1 are the first thinning point and the second thinning point, i.e., the points to be thinned out, and P n is the starting point, P is the sixth thinning point, P n+2 is the seventh thinning point. The seventh thinning point is a thinning point adjacent to the second thinning point.

[0078] Step 204, establishing a fourth connection line between the sixth thinning point and the seventh thinning point.

[0079] Among them, P and P n+2 The line between is the fourth line.

[0080] The fourth connecting line is a connecting line between the sixth thinning point and the seventh thinning point.

[0081] Step 205, establish a third perpendicular line between the first thinning point and the fourth line to obtain a third line segment, and establish a fourth perpendicular line between the second thinning point and the fourth line to obtain a fourth line segment.

[0082] like Figure 4 As shown, P n The third line segment corresponding to the third perpendicular line between the fourth line and the fourth line is Δh n , P n+1 The fourth line segment corresponding to the fourth perpendicular line between the fourth connecting line is Δh n+1 .

[0083] Step 206: Determine the sum of the square of the length of the third line segment and the square of the length of the fourth line segment.

[0084] For example, if the third line segment is Δh n , the fourth line segment is Δh n+1 , the sum of the square of the length of the third line segment and the square of the length of the fourth line segment is Δh n 2 +Δh n+1 2 .

[0085] Step 207, when any sixth thinning point on the first line makes the sum of squares obtain a minimum value, determine any sixth thinning point as a target node.

[0086] Specifically, if any sixth thinning point P makes Δh n 2 +Δh n+1 2The value of is the smallest, then any sixth thinning point can be used as the target node, and then point P can be used to replace P in the vector line. n and P n+1 , so that only P and P are retained in the vector line n+2 .

[0087] Step 208: Replace the first thinned point and the second thinned point in the vector line based on the target node.

[0088] Step 209 , in response to determining that the line with the shortest line length in the vector lines is greater than a preset thinning threshold, determining that the thinning of the vector lines is completed.

[0089] It should be noted that the specific implementation of steps 208 - 209 may refer to the above embodiment and will not be described in detail here.

[0090] In the embodiment of the present disclosure, the main features of the original line segment are retained during the thinning process, while the number of nodes is reduced, thereby reducing the amount of data and computational complexity. By deleting unnecessary nodes, the amount of data can be significantly reduced, thereby reducing storage space and transmission costs. Reducing the number of nodes can simplify the data structure, making the data easier to process and manage. By determining the position of the new node at the starting point of the shortest edge, the main features of the original line segment, such as the overall shape and trend of the curve, can be retained as much as possible during the thinning process. By minimizing Δh n 2 +Δh n+1 2 The optimal position can be determined by the value of , which can avoid traversing all nodes of the entire line segment, thereby reducing the computational complexity. The thinned line segment is more concise, which can improve the rendering efficiency and user experience of visualization applications such as maps. In summary, thinning by this method can reduce the amount of data and computational complexity while retaining the main features of the line segment, and improve the efficiency of data processing and visualization.

[0091] Figure 5 A schematic flow chart of a vector line thinning method provided in the third embodiment of the present disclosure.

[0092] like Figure 5 As shown, the vector line thinning method may include the following steps:

[0093] Step 301 , traverse the vector line from the starting point to determine the length of the line between each group of adjacent points on the vector line.

[0094] Step 302, based on the lengths of each link, determine the points to be thinned out from each group of adjacent points.

[0095] It should be noted that the specific implementation of steps 301 - 302 may refer to the above embodiment and will not be described in detail here.

[0096] Step 303, when the second thinning point is the end point, select an eighth thinning point on the first connecting line between the first thinning point and the second thinning point, and determine a ninth thinning point corresponding to the first thinning point.

[0097] Figure 6 This is a third thinning schematic diagram proposed in the embodiment of the present disclosure, such as Figure 4 As shown, P n and P n+1 are the first thinning point and the second thinning point, i.e., the points to be thinned out, and P n+1 is the end point, P is the eighth rarefaction point, P n-1 The ninth thinning point is the first thinning point P n Adjacent thinning points.

[0098] Step 304, establishing a fifth connection line between the eighth thinning point and the ninth thinning point.

[0099] Among them, P and P n-1 The line between them is the fifth line.

[0100] The fifth connecting line is a connecting line between the eighth thinning point and the ninth thinning point.

[0101] Step 305, establish a fifth perpendicular line between the first thinning point and the fifth line to obtain a fifth line segment, and establish a sixth perpendicular line between the second thinning point and the fifth line to obtain a sixth line segment.

[0102] like Figure 6 As shown, P n The fifth line segment corresponding to the fifth perpendicular line between the fifth connecting line is Δh n , P n+1 The sixth line segment corresponding to the sixth perpendicular line between the fifth line is Δh n+1 .

[0103] Step 306: Determine the sum of the square of the length of the fifth line segment and the square of the length of the sixth line segment.

[0104] For example, if the fifth line segment is Δh n , the sixth line segment is Δh n+1 , the sum of the square of the length of the fifth line segment and the square of the length of the sixth line segment is Δh n 2 +Δh n+1 2 .

[0105] Step 307: When any eighth thinning point on the first line makes the sum of squares reach a minimum value, determine any eighth thinning point as a target node.

[0106] Specifically, if any eighth thinning point P makes Δh n 2 +Δh n+1 2 The value of is the smallest, then any eighth thinning point can be used as the target node, and then point P can be used to replace P in the vector line. n and P n+1 , so that only P and P are retained in the vector line n-1 .

[0107] Step 308: Replace the first thinned-out point and the second thinned-out point in the vector line based on the target node.

[0108] Step 309 , in response to determining that the line with the shortest line length in the vector lines is greater than a preset thinning threshold, determining that the thinning of the vector lines is completed.

[0109] It should be noted that the specific implementation of steps 308 - 309 may refer to the above embodiment and will not be described in detail here.

[0110] In summary, by adding the new vector line node P n-1 and P n Connect and pass through point P n and P n+1 Draw a perpendicular line, and you can get the length of the perpendicular line Δh n and Δh n+1 Then by making Δh n 2 +Δh n+1 2 The position of the new node P is determined by minimizing the value of . The benefits of this method include: compared with the original line, the thinned line has fewer nodes, thereby reducing the storage and processing costs of data. By minimizing Δh n 2 +Δh n+1 2 The value of can preserve the main features of the original line segment as much as possible, such as the overall shape and trend of the curve. Reducing the number of nodes can simplify the data structure, making the data easier to process and manage.

[0111] The thinned line segments are more concise, which can improve the rendering efficiency and user experience of visualization applications such as maps. It avoids traversing all nodes of the entire line segment, thereby reducing the computational complexity. In summary, this method can reduce the amount of data, simplify the data structure, and improve rendering and computational efficiency while retaining the main features of the line segment.

[0112] In order to implement the above embodiment, the present disclosure also proposes a vector line thinning device.

[0113] Figure 7 This is a structural block diagram of a vector line thinning device provided in the fourth embodiment of the present disclosure.

[0114] like Figure 7 As shown, the vector line thinning device 700 may include:

[0115] A first determining module 710, configured to traverse the vector line from the starting point to determine the length of the line between each group of adjacent points on the vector line;

[0116] A second determination module 720 is used to determine the points to be thinned out from the groups of adjacent points based on the lengths of the respective connecting lines;

[0117] A thinning module 730, configured to thin out the vector line according to the position of the connecting line corresponding to the to-be-thinned point in the vector line;

[0118] The third determination module 740 is configured to determine that thinning of the vector lines is completed in response to determining that the line with the shortest line length in the vector lines is greater than a preset thinning threshold.

[0119] Optionally, the second determining module is specifically configured to:

[0120] When the first line length of the line between any group of adjacent points belongs to the minimum value among the line lengths, determining whether the first line length is less than the preset thinning threshold;

[0121] If the first connection length is less than the preset thinning threshold, terminating thinning;

[0122] If the first line length is greater than or equal to the preset thinning threshold, any group of adjacent points corresponding to the first line length is used as points to be thinned out.

[0123] Optionally, the thinning module is further used for:

[0124] In response to determining that the link with the shortest link length among the vector lines is greater than or equal to the preset thinning threshold, the vector lines continue to be thinned out.

[0125] Optionally, the points to be thinned out include a first thinning out point and a second thinning out point, each point on the vector line has a corresponding number, and the numbers increase from the starting point to the end point, the number of the first thinning out point is less than the number of the second thinning out point, and the thinning module is specifically used to:

[0126] In the case that both the first thinning point and the second thinning point are not the starting point or the end point, determining a third thinning point adjacent to the first thinning point and a fourth thinning point adjacent to the second thinning point, wherein the number of the third thinning point is smaller than the number of the fourth thinning point;

[0127] Selecting a fifth thinning point on the first line between the first thinning point and the second thinning point, connecting the fifth thinning point and the third thinning point to obtain a second line, and connecting the fifth thinning point and the fourth thinning point to obtain a third line;

[0128] Establishing a first perpendicular line from the first thinning point to the second connecting line to obtain a first line segment, and establishing a second perpendicular line from the second thinning point to the third connecting line to obtain a second line segment;

[0129] Determine a sum of the squares of the length of the first line segment and the length of the second line segment;

[0130] If any fifth thinning point on the first line makes the sum of squares obtain a minimum value, determine the any fifth thinning point as a target node;

[0131] The first thinned-out points and the second thinned-out points in the vector line are replaced based on the target node.

[0132] Optionally, the thinning module is specifically used for:

[0133] In the case where the first thinning point is the starting point, selecting a sixth thinning point on a first connecting line between the first thinning point and the second thinning point, and determining a seventh thinning point corresponding to the second thinning point;

[0134] Establishing a fourth connecting line between the sixth thinning point and the seventh thinning point;

[0135] Establishing a third perpendicular line from the first thinning point to the fourth line to obtain a third line segment, and establishing a fourth perpendicular line from the second thinning point to the fourth line to obtain a fourth line segment;

[0136] Determine a sum of the square of the segment length of the third line segment and the square of the segment length of the fourth line segment;

[0137] When any sixth thinning point on the first line makes the sum of squares obtain a minimum value, determining the any sixth thinning point as a target node;

[0138] The first thinned-out points and the second thinned-out points in the vector line are replaced based on the target node.

[0139] Optionally, the thinning module is specifically used for:

[0140] In the case where the second thinning point is the end point, selecting an eighth thinning point on the first connecting line between the first thinning point and the second thinning point, and determining a ninth thinning point corresponding to the first thinning point;

[0141] Establishing a fifth connecting line between the eighth thinning point and the ninth thinning point;

[0142] Establishing a fifth perpendicular line between the first thinning point and the fifth connecting line to obtain a fifth line segment, and establishing a sixth perpendicular line between the second thinning point and the fifth connecting line to obtain a sixth line segment;

[0143] Determine a sum of the squares of the segment length of the fifth line segment and the square of the segment length of the sixth line segment;

[0144] When any eighth thinning point on the first line makes the sum of squares obtain a minimum value, determining the any eighth thinning point as a target node;

[0145] The first thinned-out points and the second thinned-out points in the vector line are replaced based on the target node.

[0146] In the disclosed embodiment, the vector line is first traversed from the starting point to determine the length of the line between each group of adjacent points on the vector line, and then based on the length of each line, the point to be thinned is determined from each group of adjacent points, and then the vector line is thinned according to the position of the line corresponding to the point to be thinned in the vector line, and finally, in response to determining that the line with the shortest line length in the vector line is greater than the preset thinning threshold, it is determined that the thinning of the vector line is completed. Thus, the morphological trend can be kept smooth, and by reasonably setting the threshold and generating new nodes when eliminating the thinning points, it can be ensured that the morphological change trend of the vector line is slow, which means that the data after thinning will not have a sudden change or abrupt change, and the overall morphology of the original data is maintained. Since each thinning takes into account the morphological change trend and the way to generate new nodes, the relative difference of each thinning result will be minimized. This means that even in multiple iterations, the difference between the thinning results will be reduced as much as possible, which improves the consistency and stability of the results. By reasonably setting parameters and generating new nodes, the thinning result can retain the skeleton and main structure of the original data. This means that even if thinning is performed, the data can still accurately reflect the main features and morphology of the original data. It supports multiple iterations by setting different thresholds to maximize the thinning rate. This means that while maintaining the data form, it is possible to minimize the redundant information of the data and improve the simplicity and efficiency of the data. This thinning method can maintain the consistency, stability and accuracy of the data on the basis of taking into account both the form and the thinning rate, so that the thinned data is more in line with actual needs and application scenarios. On the basis of maintaining the original form characteristics, the amount of data is reduced by reducing the data nodes to save storage space and improve processing efficiency.

[0147] In order to implement the above embodiments, the present disclosure further proposes a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the vector line thinning method proposed in the above embodiments of the present disclosure is implemented.

[0148] In order to implement the above embodiments, the present disclosure further proposes a non-temporary computer-readable storage medium storing a computer program, which, when executed by a processor, implements the vector line thinning method proposed in the above embodiments of the present disclosure.

[0149] In order to implement the above embodiments, the present disclosure further proposes a computer program product. When an instruction processor in the computer program product executes, the vector line thinning method proposed in the above embodiments of the present disclosure is executed.

[0150] Figure 8 A block diagram of an exemplary computer device suitable for implementing embodiments of the present disclosure is shown. Figure 8The computer device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0151] like Figure 8 As shown, the computer device 12 is in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).

[0152] The bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnection (PCI) bus.

[0153] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.

[0154] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 8 not shown, usually called a "hard drive"). Although Figure 8Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a compact disc read only memory (CD-ROM), a digital versatile disc read only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the various embodiments of the present disclosure.

[0155] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described in the present disclosure.

[0156] The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the computer device 12, and / or any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed via an input / output (I / O) interface 22. In addition, the computer device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the computer device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0157] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the methods mentioned in the above embodiments.

[0158] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0159] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0160] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present disclosure includes additional implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present disclosure belong.

[0161] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0162] It should be understood that the various parts of the present disclosure can be implemented in hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0163] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0164] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0165] The storage medium mentioned above may be a read-only memory, a disk or an optical disk, etc. Although the embodiments of the present disclosure have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations of the present disclosure. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present disclosure.

Claims

1. A vector line thinning method, characterized in that: include: Traversing the vector line from the starting point to determine the length of the connection line between each group of adjacent points on the vector line; Based on the lengths of the respective connecting lines, determining the points to be thinned out from the respective groups of adjacent points; Thinning out the vector line according to the position of the connecting line corresponding to the to-be-thinned point in the vector line; In response to determining that the line with the shortest line length among the vector lines is greater than a preset thinning threshold, determining that thinning of the vector lines is completed; The points to be thinned out include a first thinning point and a second thinning point. Each point on the vector line has a corresponding number, and the numbers increase from the starting point to the end point. The number of the first thinning point is smaller than the number of the second thinning point. The thinning out of the vector line according to the position of the connecting line corresponding to the to-be-thinned point in the vector line comprises: In the case that both the first thinning point and the second thinning point are not the starting point or the end point, determining a third thinning point adjacent to the first thinning point and a fourth thinning point adjacent to the second thinning point, wherein the number of the third thinning point is smaller than the number of the fourth thinning point; Selecting a fifth thinning point on the first line between the first thinning point and the second thinning point, connecting the fifth thinning point and the third thinning point to obtain a second line, and connecting the fifth thinning point and the fourth thinning point to obtain a third line; Establishing a first perpendicular line from the first thinning point to the second connecting line to obtain a first line segment, and establishing a second perpendicular line from the second thinning point to the third connecting line to obtain a second line segment; Determine a sum of the squares of the length of the first line segment and the length of the second line segment; If any fifth thinning point on the first line makes the sum of squares obtain a minimum value, determine the any fifth thinning point as a target node; The first thinned-out points and the second thinned-out points in the vector line are replaced based on the target node.

2. The method according to claim 1, characterized in that The step of determining the points to be thinned out from the groups of adjacent points based on the lengths of the respective connecting lines comprises: When the first line length of the line between any group of adjacent points belongs to the minimum value among the line lengths, determining whether the first line length is greater than the preset thinning threshold; If the first connection length is greater than the preset thinning threshold, terminating thinning; If the first line length is less than or equal to the preset thinning threshold, any group of adjacent points corresponding to the first line length is used as points to be thinned out.

3. The method according to claim 1, characterized in that After thinning out the vector lines according to the positions of the connecting lines corresponding to the points to be thinned out in the vector lines, the method further includes: In response to determining that the line with the shortest line length in the vector lines is less than or equal to the preset thinning threshold, the vector lines continue to be thinned out.

4. The method according to claim 1, characterized in that The thinning out of the vector line according to the position of the connecting line corresponding to the to-be-thinned point in the vector line comprises: In the case where the first thinning point is the starting point, selecting a sixth thinning point on a first connecting line between the first thinning point and the second thinning point, and determining a seventh thinning point corresponding to the second thinning point; Establishing a fourth connecting line between the sixth thinning point and the seventh thinning point; Establishing a third perpendicular line from the first thinning point to the fourth line to obtain a third line segment, and establishing a fourth perpendicular line from the second thinning point to the fourth line to obtain a fourth line segment; Determine a sum of the square of the segment length of the third line segment and the square of the segment length of the fourth line segment; When any sixth thinning point on the first line makes the sum of squares obtain a minimum value, determining the any sixth thinning point as a target node; The first thinned-out points and the second thinned-out points in the vector line are replaced based on the target node.

5. The method according to claim 1, characterized in that: The thinning out of the vector line according to the position of the connecting line corresponding to the to-be-thinned point in the vector line comprises: In the case where the second thinning point is the end point, selecting an eighth thinning point on the first connecting line between the first thinning point and the second thinning point, and determining a ninth thinning point corresponding to the first thinning point; Establishing a fifth connecting line between the eighth thinning point and the ninth thinning point; Establishing a fifth perpendicular line between the first thinning point and the fifth connecting line to obtain a fifth line segment, and establishing a sixth perpendicular line between the second thinning point and the fifth connecting line to obtain a sixth line segment; Determine a sum of the squares of the segment length of the fifth line segment and the square of the segment length of the sixth line segment; When any eighth thinning point on the first line makes the sum of squares obtain a minimum value, determining the any eighth thinning point as a target node; The first thinned-out points and the second thinned-out points in the vector line are replaced based on the target node.

6. A vector line thinning device, characterized in that: include: A first determining module, used to traverse the vector line from the starting point to determine the length of the connection line between each group of adjacent points on the vector line; A second determination module is used to determine the points to be thinned out from the groups of adjacent points based on the lengths of the respective connecting lines, wherein the points to be thinned out include a first thinned out point and a second thinned out point, each point on the vector line has a corresponding number, and the numbers increase from the starting point to the end point in sequence, and the number of the first thinned out point is smaller than the number of the second thinned out point; A thinning module, used for thinning out the vector line according to the position of the connecting line corresponding to the to-be-thinned point in the vector line; A third determination module, configured to determine that thinning of the vector lines is completed in response to determining that the line with the shortest line length among the vector lines is greater than a preset thinning threshold; The thinning module is specifically used for: In the case that both the first thinning point and the second thinning point are not the starting point or the end point, determining a third thinning point adjacent to the first thinning point and a fourth thinning point adjacent to the second thinning point, wherein the number of the third thinning point is smaller than the number of the fourth thinning point; Selecting a fifth thinning point on the first line between the first thinning point and the second thinning point, connecting the fifth thinning point and the third thinning point to obtain a second line, and connecting the fifth thinning point and the fourth thinning point to obtain a third line; Establishing a first perpendicular line from the first thinning point to the second connecting line to obtain a first line segment, and establishing a second perpendicular line from the second thinning point to the third connecting line to obtain a second line segment; Determine a sum of the squares of the length of the first line segment and the length of the second line segment; If any fifth thinning point on the first line makes the sum of squares obtain a minimum value, determine the any fifth thinning point as a target node; The first thinned-out points and the second thinned-out points in the vector line are replaced based on the target node.

7. The device according to claim 6, characterized in that The second determining module is specifically used to: When the first line length of the line between any group of adjacent points belongs to the minimum value among the line lengths, determining whether the first line length is greater than the preset thinning threshold; If the first connection length is greater than the preset thinning threshold, terminating thinning; If the first line length is less than or equal to the preset thinning threshold, any group of adjacent points corresponding to the first line length is used as points to be thinned out.

8. The device according to claim 6, characterized in that The rarefaction module is used to: In response to determining that the line with the shortest line length in the vector lines is less than or equal to the preset thinning threshold, the vector lines continue to be thinned out.

Citation Information

Patent Citations

  • Geographic space data loading method and device based on thinning algorithm and storage medium

    CN110263110A