A multi-stage thinning method and device for spatial line data
Patent Information
- Application Number
- CN202410672133.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2044-05-28
AI Technical Summary
[0005]有鉴于此,本发明的目的在于提供一种空间线数据多级抽稀方法及设备,用于解决由于海量空间线数据,导致的数据查询速度慢,地图浏览卡顿的问题
[0034] By performing dual thinning using a first and a second thinning threshold, jagged edges and excessively short line segments in the line data are effectively removed, significantly reducing the data volume. Based on the map scale, multiple thinning data are cached at multiple levels, which improves the speed of generating spatial line data and enhances rendering efficiency and display effect while enabling dynamic layer switching.
Smart Images

Figure CN118708662B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data visualization, and in particular to a method and apparatus for multi-level thinning of spatial line data. Background Technology
[0002] With the development of information technology, mapping and GIS technologies have gradually become integrated into people's lives and work, resulting in massive spatial data assets, such as navigation and positioning data, pipeline mapping data, personnel movement data, and urban road data. Data visualization, as an important form of representation of spatial data assets, has been widely used in mobile GIS and Web GIS. While the accumulation of massive data assets provides abundant resources, it also brings challenges to data management and application.
[0003] Spatial line data is a common form of urban spatial data, containing large-scale line elements with data volumes reaching millions, tens of millions, or even hundreds of millions. This massive scale increases the load on data reading, processing, and graphics loading. As the data volume increases, the rendering effects and processing speed of map services place increasingly higher demands on machine configuration, network bandwidth, and spatial database query performance. When querying and rendering massive amounts of spatial line data, not only is the query performance of the spatial database itself limited, increasing the computer's rendering burden, but it is also difficult to guarantee a good real-time viewing experience on mobile and web devices. To ensure rendering quality, improve system response speed and data visualization effects, and meet different application needs, a multi-level-of-detail approach is typically used to configure map services, but this is still limited by the performance constraints of querying and displaying massive amounts of spatial line data.
[0004] In summary, existing spatial line data visualization suffers from problems such as large storage space requirements, slow map output speed, and poor map browsing service experience. Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a method and device for multi-level thinning of spatial line data, which can solve the problems of slow data query speed and map browsing lag caused by massive spatial line data.
[0006] This invention provides a multi-level thinning method for spatial line data, comprising:
[0007] S1: Extract all line segments from the spatial database, and form an initial line segment set M from all the line segments;
[0008] S2: Set the map scale size S for the i-th level. i and the first thinning threshold d i1 Through S i and d i1Filter the rough edges in M to obtain the first thinning result M. i,1 ;
[0009] S3: M i,1 The line segments are grouped according to their attributes to obtain multiple line segment groups; each line segment group is aggregated to obtain multiple line sets; and a spatial topology tree is constructed from the line sets.
[0010] S4: Set the second thinning threshold d i2 Through S i and d i2 The lines in the spatial topology tree are trimmed and spliced to obtain the second thinning result M. i,2 ;
[0011] S5: Repeat steps S2 to S4 to obtain the second thinning results for each level. The final thinned data set M is composed of all the second thinning results. vacuate , thin the data set M vacuate Store in the spatial database.
[0012] Preferably, step S2 specifically includes:
[0013] S21: If one end of a line segment has a common point with other line segments, while the other end has no intersection with other line segments, then the line segment is determined to be a rough edge, and all rough edges in M are obtained.
[0014] S22: via S i Calculate d i1 The length of the thinned line segment corresponding to each pixel is l. i ;
[0015] S23: Select the length less than l from M. i The rough edges are filtered out, and the remaining line segments in M are retained to obtain the first thinning result M. i,1 .
[0016] Preferably, S3 is as follows:
[0017] S31: M i,1 The line segments in the diagram are grouped according to their attributes to obtain multiple line segment groups. All line segments in a line segment group have the same attribute.
[0018] S32: Aggregate the line segments in a certain line segment group and merge the line segments with spatial relationships into a line set;
[0019] S33: Repeat step S32 to obtain all the line sets, and construct a spatial topology tree using all the line sets.
[0020] Preferably, S4 is as follows:
[0021] S41: Through Si Calculate d i2 The length of the thinned line segment corresponding to each pixel is l. i ;
[0022] S42: Obtain all lines in the spatial topology tree, via l i The lines are trimmed and spliced to obtain the second thinning result M. i,2 .
[0023] Preferably, step S42 specifically includes:
[0024] S421: Obtain line L u Line L u It contains V line segments, where u is the line number;
[0025] S422: Line L u Medium length less than l i The line segment is cut, and a new line L' is obtained by moving the undone line segment and splicing the start and end points of the cut line segment together. u ;
[0026] S423: Repeat steps S421-S422 until all lines have been cut and spliced.
[0027] Preferred:
[0028] Thinning line segment length l i The calculation formula is:
[0029] l i =S i *0.0254 / 90*Pixel
[0030] Wherein, Pixel represents the unit length of a pixel.
[0031] A storage medium storing instructions and data for implementing the aforementioned spatial line data multi-level thinning method.
[0032] A spatial line data multi-level thinning device includes: a processor and a storage medium; the processor loads and executes instructions and data in the storage medium to implement the spatial line data multi-level thinning method.
[0033] The present invention has the following beneficial effects:
[0034] By performing dual thinning using a first and a second thinning threshold, jagged edges and excessively short line segments in the line data are effectively removed, significantly reducing the data volume. Based on the map scale, multiple thinning data are cached at multiple levels, which improves the speed of generating spatial line data and enhances rendering efficiency and display effect while enabling dynamic layer switching. Attached Figure Description
[0035] Figure 1 This is a flowchart of a method according to an embodiment of the present invention;
[0036] Figure 2 This is a schematic diagram of a filter for rough edges;
[0037] Figure 3 This is a diagram illustrating the cutting and splicing of lines.
[0038] Figure 4 The amount of data stored in traditional spatial data storage;
[0039] Figure 5 This refers to the data volume of the thinned data set ultimately obtained by this invention.
[0040] Figure 6 Compared to the mapping speed of traditional spatial data;
[0041] Figure 7 This invention improves the graphing speed of the thinned data set.
[0042] Figure 8 This is a structural diagram of the device according to an embodiment of the present invention;
[0043] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0044] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0045] Reference Figure 1 This application provides a multi-level thinning method for spatial line data, including:
[0046] S1: Extract all line segments from the spatial database, and form an initial line segment set M from all the line segments;
[0047] Specifically, the spatial database contains spatial data including: road network, pipeline network, trajectory and other spatial line data;
[0048] S2: Set the map scale size S for the i-th level. i and the first thinning threshold d i1 Through S i and d i1 Filter the rough edges in M to obtain the first thinning result M. i,1 ;
[0049] Furthermore, since the original spatial dataset contains jagged elements, these jagged elements not only occupy memory space, but their small size also affects the visual experience during rendering. Therefore, it is necessary to remove the jagged elements first. The method for judging jagged elements is: any endpoint of the current line segment element has a common point with other elements, and the other end has no spatial intersection with other elements. The filtering effect of jagged elements is as follows: Figure 2 As shown;
[0050] Step S2 is as follows:
[0051] S21: If one end of a line segment has a common point with other line segments, while the other end has no intersection with other line segments, then the line segment is determined to be a rough edge, and all rough edges in M are obtained.
[0052] S22: via S i Calculate d i1 The length of the thinned line segment corresponding to each pixel is l. i ;
[0053] Thinning line segment length l i The calculation formula is:
[0054] l i =S i *0.0254 / 90*Pixel
[0055] Wherein, Pixel represents the unit length of a pixel.
[0056] S23: Select the length less than l from M. i The rough edges are filtered out, and the remaining line segments in M are retained to obtain the first thinning result M. i,1 .
[0057] S3: M i,1 The line segments are grouped according to their attributes to obtain multiple line segment groups; each line segment group is aggregated to obtain multiple line sets; and a spatial topology tree is constructed from the line sets.
[0058] Furthermore, S3 specifically refers to:
[0059] S31: M i,1 The line segments in the diagram are grouped according to their attributes to obtain multiple line segment groups. All line segments in a line segment group have the same attribute.
[0060] Specifically, the attributes of the line segments are input by the user from outside the algorithm, and the attributes include: length, type, characteristics, etc.; after grouping, all line segments corresponding to each group attribute are obtained;
[0061] S32: Aggregate the line segments in a certain line segment group and merge the line segments with spatial relationships into a line set;
[0062] Specifically, a line set contains a collection of all line features with the same grouping attribute, and these line features share the same grouping condition attribute information;
[0063] S33: Repeat step S32 to obtain all the line sets, and construct a spatial topology tree using all the line sets.
[0064] S4: Set the second thinning threshold d i2 Through S i and d i2 The lines in the spatial topology tree are trimmed and spliced to obtain the second thinning result M. i,2 ;
[0065] Furthermore, S4 specifically refers to:
[0066] S41: Through S i Calculate d i2 The length of the thinned line segment corresponding to each pixel is l. i ;
[0067] S42: Obtain all lines in the spatial topology tree, via l i The lines are trimmed and spliced to obtain the second thinning result M. i,2 .
[0068] Furthermore, step S42 specifically includes:
[0069] S421: Obtain line L u Line L u It contains V line segments, where u is the line number;
[0070] S422: Line L u Medium length less than l i The line segment is cut, and a new line L' is obtained by moving the undone line segment and splicing the start and end points of the cut line segment together. u ;
[0071] Specifically, the process of cutting and splicing the lines is as follows: Figure 3 As shown, assuming the second thinning threshold d i2 Given 1 pixel, determine whether the lengths of line segments AB, BC, and CD in line AD are less than the length l of the thinned line segment corresponding to 1 pixel. i If the length of line segment BC is less than l i The lengths of line segments AB and CD are greater than l. i Then, cut line segment BC and move endpoint B to point C to form line A1D1.
[0072] S423: Repeat steps S421-S422 until all lines have been cut and spliced.
[0073] Specifically, the system queries the endpoints of all lines in the spatial topology tree, and then traverses all lines sequentially through these endpoints to perform trimming and splicing.
[0074] S5: Repeat steps S2 to S4 to obtain the second thinning results for each level. The final thinned data set M is composed of all the second thinning results. vacuate , thin the data set M vacuate Store in the spatial database.
[0075] This invention provides a multi-level thinning method for spatial line data based on the principle of visual thinning. Through a dual thinning strategy, it significantly reduces the amount of data, such as... Figure 4 The amount of data stored in traditional spatial data storage reached 1,261,588 rows; Figure 5 The data volume of the final thinned dataset obtained by this invention is shown in the figures. The second thinning results of the four levels are 375,998 rows, 4,848 rows, 4,554 rows, and 4,463 rows, respectively. It can be seen that the data volume is greatly reduced compared to traditional spatial data.
[0076] Furthermore, this invention improves the speed of spatial line data retrieval by more than 10 times through multi-level caching (based on map scale) and dynamic layer switching, such as... Figure 6 For traditional spatial data, the mapping speed requires approximately 15 seconds; such as Figure 7 The plotting speed of the thinned dataset of this invention is only about 200ms, which greatly improves the plotting speed.
[0077] Please see Figure 8 , Figure 8 This is a schematic diagram of the hardware device in operation according to an embodiment of the present invention. The hardware device specifically includes: a spatial line data multi-level thinning device 401, a processor 402, and a storage medium 403.
[0078] A spatial line data multi-level thinning device 401: The spatial line data multi-level thinning device 401 implements the spatial line data multi-level thinning method.
[0079] Processor 402: The processor 402 loads and executes the instructions and data in the storage medium 403 to implement the spatial line data multi-level thinning method.
[0080] Storage medium 403: The storage medium 403 stores instructions and data; the storage medium 403 is used to implement the spatial line data multi-level thinning method.
[0081] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0082] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. In the unit claims listing several devices, several of these devices may be embodied by the same hardware item. The use of the terms first, second, and third, etc., does not indicate any order and can be interpreted as identifiers.
[0083] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A multi-level thinning method for spatial line data, characterized in that, include: S1: Extract all line segments from the spatial database, and form an initial line segment set M from all the line segments; S2: Set the first i Map scale size at each level S i and the first thinning threshold d i1 ,pass S i and d i1 Filter the rough edges in M to obtain the first thinning result M. i,1 ; Step S2 is as follows: S21: If one end of a line segment has a common point with other line segments, while the other end has no intersection with other line segments, then the line segment is determined to be a rough edge, and all rough edges in M are obtained. S22: Through S i Calculation obtained d i1 The length of the thinned line segment corresponding to each pixel l i ; S23: Select the length of M that is less than... l i The rough edges are filtered out, and the remaining line segments in M are retained to obtain the first thinning result M. i,1 ; S3: M i,1 The line segments are grouped according to their attributes to obtain multiple line segment groups; each line segment group is aggregated to obtain multiple line sets; and a spatial topology tree is constructed from the line sets. S3 specifically refers to: S31: M i,1 The line segments in the diagram are grouped according to their attributes to obtain multiple line segment groups. All line segments in a line segment group have the same attribute. S32: Aggregate the line segments in a certain line segment group and merge the line segments with spatial relationships into a line set; S33: Repeat step S32 to obtain all the line sets, and construct a spatial topology tree using all the line sets; S4: Set the second thinning threshold d i2 ,pass S i and d i2 The lines in the spatial topology tree are trimmed and spliced to obtain the second thinning result M. i,2 ; S4 specifically refers to: S41: Through S i Calculation obtained d i2 The length of the thinned line segment corresponding to each pixel l i ; S42: Obtain all lines in the spatial topology tree, through... l i The lines are trimmed and spliced to obtain the second thinning result M. i,2 ; S5: Repeat steps S2 to S4 to obtain the second thinning results for each level. The final thinned data set M is composed of all the second thinning results. vacuate , thin the data set M vacuate Store in the spatial database.
2. The multi-level thinning method for spatial line data according to claim 1, characterized in that, Step S42 is as follows: S421: Get line L u Line L u It contains V line segments, where u is the line number; S422: Line L u Medium length less than l i The line segment is cut, and a new line L' is obtained by moving the undone line segment and splicing the start and end points of the cut line segment together. u ; S423: Repeat steps S421-S422 until all lines have been cut and spliced.
3. A storage medium, characterized in that: The storage medium stores instructions and data to implement the spatial line data multi-level thinning method according to any one of claims 1 to 2.
4. A multi-stage thinning device for spatial line data, characterized in that: include: A processor and a storage medium; the processor loads and executes instructions and data in the storage medium to implement the spatial line data multi-level thinning method according to any one of claims 1 to 2.
Citation Information
Patent Citations
Road network map multistage dynamic loading method based on multistage thinning algorithm
CN112579942A
Massive point cloud data processing and visualization method and system
CN113781631A