A linear slope map spot extraction method, system and storage medium with a width less than or equal to 1 grid
By generating a set of map spots and removing rectangles, the problem of automatically identifying linear slope spots with a width of less than or equal to one grid in complex polygonal slope spots was solved, achieving efficient and accurate spot extraction and improving the automation processing capability of land surveys.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- YUNNAN AGRI VOCATIONAL & TECH COLLEGE
- Filing Date
- 2025-09-17
- Publication Date
- 2026-07-21
AI Technical Summary
Existing technologies cannot efficiently and accurately identify and extract linear slope patches with a width of less than or equal to one grid from complex polygonal slope patches, resulting in low computational efficiency and large errors, which cannot meet the automated processing needs of land surveys.
By generating a set of map spots, calculating and completing the coordinates of boundary nodes, finding and marking rectangles within the map spots, removing rectangles with a width greater than or equal to two grids, and leaving the remaining map spots as linear slope map spots with a width less than or equal to one grid, a direct correlation mechanism between the width of rectangles within the map spots and the size of the DEM grid is established.
It significantly improves the accuracy and efficiency of linear slope patch identification, reduces algorithm complexity and computational resource consumption, ensures that slope classification results meet national standards, and enhances the automation level of land surveys and the reliability of terrain feature identification.
Smart Images

Figure CN121236330B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of land and resources management technology, and more specifically to a method, system, and storage medium for extracting linear slope patches with a width of less than or equal to one grid. Background Technology
[0002] Currently, farmland slope surveys are a crucial component of national land surveys. The quality of slope grading maps directly impacts the scientific rigor and accuracy of natural resource management decisions. The "Technical Regulations for the Production of Slope Grading Maps for National Land Surveys" outlines the general principles and specific requirements for using digital elevation models (DEMs) to create these maps. The document mandates that, during the slope grading map production process, linear slope patches with a width of one grid cell or less should be merged into adjacent patches using an average allocation principle. A primary condition for achieving this is the accurate and efficient extraction of linear slope patches with a width ≤ one grid cell from a massive dataset. However, current technology lacks mature algorithms to efficiently calculate the actual width of vector slope patches with irregular shapes and boundaries, thus automating the extraction of target patches.
[0003] Because the shapes of vector slope patches are very complex, traditional methods usually use indicators such as patch area and aspect ratio to initially screen narrow linear patches, and then rely on manual visual judgment to identify linear slope patches with a width of less than or equal to 1 grid. This will produce large errors when dealing with complex polygons, and the computational efficiency is low, which cannot support the rapid screening of massive patches.
[0004] Therefore, how to achieve accurate and efficient automatic identification of linear slope patches with a width of ≤1 grid to meet the automated processing requirements specified in the technology is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] In view of this, the present invention provides a method, system and storage medium for extracting linear slope patches with a width of less than or equal to one grid, in order to solve the problems existing in the background art.
[0006] To achieve the above objectives, the present invention adopts the following technical solution:
[0007] A method for extracting linear slope patches with a width less than or equal to one grid, comprising:
[0008] Step 1: Traverse the polygons in the slope grading map, generate a set of polygons, and obtain the coordinate information of all boundary nodes of each polygon.
[0009] Step 2: Based on the coordinate information of the boundary nodes of the polygon, calculate all the coordinate point combinations, compare them with the existing nodes, and complete all the points.
[0010] Step 3: Within the patch area, find and mark any rectangles with a side length of two grid widths or more.
[0011] Step 4: Repeat steps 1-3 until all patches have been traversed;
[0012] Step 5: Remove rectangular patches with a width of two or more grids within the graphic. The remaining patches are linear slope patches with a width of one grid or less.
[0013] Optionally, step 2 specifically includes:
[0014] Step 2.1: Extract the X and Y coordinates of all points in the polygon boundary nodes to obtain all combinations of X and Y coordinate values. Compare the coordinate values in the combinations with the existing boundary node coordinate values of the polygon to find the non-existent node coordinate pairs.
[0015] Step 2.2: Determine the position of the non-existent node coordinate pair. If it is within the area or boundary of the current patch, add the node to the current patch set; otherwise, skip the step.
[0016] Step 2.3: Repeat steps 2.1 and 2.2 until all the combined points have been traversed.
[0017] Optionally, step 3 specifically includes:
[0018] Step 3.1: First, select a group of points with the same x-coordinate from the set of points on the graph, and then subtract the y-coordinates to obtain the side lengths.
[0019] Step 3.2: Determine if there is an edge with a length greater than or equal to two grid widths. If not, return to Step 3.1 and continue searching for the next set of points with the same x-coordinate. If there is an edge with a length greater than or equal to two grid widths, check the horizontal direction to see if there is an edge with a length greater than or equal to two grid widths. If not, return to Step 3.1. If there is an edge, mark that there is a rectangle with a side length of two grid widths or more within the polygon, and end the search.
[0020] Step 3.3: Repeat steps 3.1 and 3.2 until all points with the same x-coordinate have been traversed, thus completing the search process.
[0021] Optionally, step 3.1 specifically includes:
[0022] Since the patches in the slope grading map are all converted from slope grading raster data, their interior angles are all 90 degrees. From a vertical perspective, if the same horizontal coordinate and different vertical coordinates are on a vertical line, the difference between their vertical coordinate values is the side length. From a horizontal perspective, if the same vertical coordinate and different horizontal coordinates are on a horizontal line, the difference between their horizontal coordinates is the side length.
[0023] Optionally, step 3.2 specifically includes:
[0024] Step 3.21: If the side length between (x1,y1) and (x1,y2) is greater than or equal to two grid widths, extract all points with y1 as the vertical coordinate, subtract x1 from their horizontal coordinates respectively, and calculate the side length between the two points.
[0025] Step 3.22: If the side length between (x2,y1) and (x1,y1) is greater than or equal to two grid widths, then determine the position of point (x2,y2). If it is within the area of the patch or on the boundary, mark that there is a rectangle with a side length of two grid widths or more within the patch.
[0026] A system for extracting linear slope patches with a width of 1 grid cell or less includes:
[0027] The coordinate information acquisition module traverses the patches in the slope grading map, generates a patch set, and acquires the coordinate information of all boundary nodes of each polygon.
[0028] The coordinate point completion module calculates all coordinate point combinations based on the coordinate information of the boundary nodes of the polygon, compares them with the existing nodes, and completes all points.
[0029] The graphic marking module searches for and marks rectangles with sides of two grid widths or more within the patch area.
[0030] The map feature traversal module repeatedly runs the coordinate information acquisition module, the coordinate point completion module, and the graphic marking module until all map features have been traversed.
[0031] The feature extraction module removes rectangular features with a width of two or more grid cells within the graphic, leaving linear slope features with a width of one grid cell or less.
[0032] A storage medium storing a computer program that, when run on a computer, causes the computer to execute the method for extracting linear slope patches with a width less than or equal to one grid.
[0033] As can be seen from the above technical solution, compared with the prior art, this invention discloses a method, system, and storage medium for extracting linear slope patches with a width of less than or equal to one grid cell. By innovatively establishing a direct correlation mechanism between the width of the rectangle contained in the patch and the size of the DEM grid, it breaks through the technical bottleneck of traditional methods in calculating the geometric width of complex polygons, thus bringing about several significant effects: significantly improving the recognition accuracy and efficiency of linear slope patches with a width ≤ one grid cell, avoiding the tediousness and errors of calculating the geometric width of complex boundaries, and greatly reducing the algorithm complexity and computational resource consumption. Technically, it achieves high-precision recognition of fragmented linear patches, with processing efficiency more than 100 times higher than manual screening; operationally, it ensures that the slope grading results strictly comply with national standards, significantly improving the automated production level of land survey slope grading maps; at the same time, it enhances the reliability and stability of terrain feature recognition, providing more accurate and efficient basic data support for applications such as refined terrain analysis, geological disaster risk assessment, and hydrological simulation, and has significant practical value and promotion potential. Attached Figure Description
[0034] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0035] Figure 1 A schematic diagram of the method principle provided by this invention;
[0036] Figure 2 Example of a linear slope pattern with a width of less than or equal to one grid provided by the present invention;
[0037] Figure 3 This is a flowchart illustrating a method for extracting linear slope patches with a width less than or equal to one grid cell, as provided by the present invention. Detailed Implementation
[0038] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0039] This invention discloses a method for extracting linear slope patches with a width less than or equal to one grid cell, such as... Figure 1 As shown, it includes:
[0040] Step 1: Traverse the polygons in the slope grading map, generate a set of polygons, and obtain the coordinate information of all boundary nodes of each polygon.
[0041] Step 2: Based on the coordinate information of the boundary nodes of the polygon, calculate all the coordinate point combinations, compare them with the existing nodes, and complete all the points.
[0042] Step 3: Within the patch area, find and mark any rectangles with a side length of two grid widths or more.
[0043] Step 4: Repeat steps 1-3 until all patches have been traversed;
[0044] Step 5: Remove rectangular patches with a width of two or more grids within the graphic. The remaining patches are linear slope patches with a width of one grid or less.
[0045] In one specific embodiment, step 2 specifically includes:
[0046] Step 2.1: Extract the X and Y coordinates of all points in the polygon boundary nodes to obtain all combinations of X and Y coordinate values. Compare the coordinate values in the combinations with the existing boundary node coordinate values of the polygon to find the non-existent node coordinate pairs.
[0047] Step 2.2: Determine the position of the non-existent node coordinate pair. If it is within the area or boundary of the current patch, add the node to the current patch set; otherwise, skip the step.
[0048] Step 2.3: Repeat steps 2.1 and 2.2 until all the combined points have been traversed.
[0049] In one specific embodiment, step 3 specifically includes:
[0050] Step 3.1: First, select a group of points with the same x-coordinate from the set of points on the graph, and then subtract the y-coordinates to obtain the side lengths.
[0051] Step 3.2: Determine if there is an edge with a length greater than or equal to two grid widths. If not, return to Step 3.1 and continue searching for the next set of points with the same x-coordinate. If there is an edge with a length greater than or equal to two grid widths, check the horizontal direction to see if there is an edge with a length greater than or equal to two grid widths. If not, return to Step 3.1. If there is an edge, mark that there is a rectangle with a side length of two grid widths or more within the polygon, and end the search.
[0052] Step 3.3: Repeat steps 3.1 and 3.2 until all points with the same x-coordinate have been traversed, thus completing the search process.
[0053] In one specific embodiment, step 3.1 specifically includes:
[0054] Since the patches in the slope grading map are all converted from slope grading raster data, their interior angles are all 90 degrees. From a vertical perspective, if the same horizontal coordinate and different vertical coordinates are on a vertical line, the difference between their vertical coordinate values is the side length. From a horizontal perspective, if the same vertical coordinate and different horizontal coordinates are on a horizontal line, the difference between their horizontal coordinates is the side length.
[0055] In one specific embodiment, step 3.2 specifically includes:
[0056] Step 3.21: If the side length between (x1,y1) and (x1,y2) is greater than or equal to two grid widths, extract all points with y1 as the vertical coordinate, subtract x1 from their horizontal coordinates respectively, and calculate the side length between the two points.
[0057] Step 3.22: If the side length between (x2,y1) and (x1,y1) is greater than or equal to two grid widths, then determine the position of point (x2,y2). If it is within the area of the patch or on the boundary, mark that there is a rectangle with a side length of two grid widths or more within the patch.
[0058] Compared to traditional methods that rely on complex polygon geometry for width calculation, are susceptible to interference from irregular shapes, have low computational efficiency, and struggle to accurately define "one grid width," this invention innovatively links the calculation of the width of the largest rectangle within a patch directly to the DEM grid size. By constructing a rectangle inscribed within the patch and using its shorter side width as a feature, it directly compares this width with a preset DEM grid size (e.g., 30 meters) for a threshold comparison (≤1 grid size). This efficiently and stably filters out linear slope patches that truly meet the "width ≤ 1 grid" requirement. Its advantages include: ① Overcoming geometric complexity limitations by utilizing the rectangle width feature to avoid interference from polygonal concave / convex boundaries in width calculation; ② Ensuring that the "width ≤ 1 grid" selection criterion has a clear and consistent geographical scale significance by comparing the calculated rectangle width with the DEM grid size, resulting in results strictly consistent with actual terrain resolution; ③ Significantly improving computational efficiency and simplifying the width measurement process, making it particularly suitable for large-scale DEM data processing.
[0059] A system for extracting linear slope patches with a width of 1 grid cell or less includes:
[0060] The coordinate information acquisition module traverses the patches in the slope grading map, generates a patch set, and acquires the coordinate information of all boundary nodes of each polygon.
[0061] The coordinate point completion module calculates all coordinate point combinations based on the coordinate information of the boundary nodes of the polygon, compares them with the existing nodes, and completes all points.
[0062] The graphic marking module searches for and marks rectangles with sides of two grid widths or more within the patch area.
[0063] The map feature traversal module repeatedly runs the coordinate information acquisition module, the coordinate point completion module, and the graphic marking module until all map features have been traversed.
[0064] The feature extraction module removes rectangular features with a width of two or more grid cells within the graphic, leaving linear slope features with a width of one grid cell or less.
[0065] A storage medium storing a computer program that, when run on a computer, causes the computer to execute a method for extracting linear slope patches with a width less than or equal to one grid.
[0066] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0067] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for extracting linear slope patches with a width less than or equal to one grid, characterized in that, include: Step 1: Traverse the polygons in the slope grading map, generate a set of polygons, and obtain the coordinate information of all boundary nodes of each polygon. Step 2: Based on the coordinate information of the boundary nodes of the polygon, calculate all the coordinate point combinations, compare them with the existing nodes, and complete all the points. Step 3: Within the patch area, find and mark any rectangles with a side length of two grid widths or more. Step 4: Repeat steps 1-3 until all patches have been traversed; Step 5: Remove rectangular patches with a width of two or more grids within the graphic; the remaining patches are linear slope patches with a width of one grid or less. Step 3 specifically includes: Step 3.1: First, select a group of points with the same x-coordinate from the set of points on the graph, and then subtract the y-coordinates to obtain the side lengths. Step 3.2: Determine if there is an edge with a length greater than or equal to two grid widths. If not, return to Step 3.1 and continue searching for the next set of points with the same x-coordinate. If there is an edge with a length greater than or equal to two grid widths, check the horizontal direction to see if there is an edge with a length greater than or equal to two grid widths. If not, return to Step 3.
1. If there is an edge, mark that there is a rectangle with a side length of two grid widths or more within the polygon, and end the search. Step 3.3: Repeat steps 3.1 and 3.2 until all points with the same x-coordinate have been traversed, completing the search process; Step 3.1 specifically includes: Since the patches in the slope grading map are all converted from slope grading raster data, their interior angles are all 90 degrees. From a vertical perspective, if the same horizontal coordinate and different vertical coordinates are on a vertical line, the difference between their vertical coordinate values is the side length. From a horizontal perspective, if the same vertical coordinate and different horizontal coordinates are on a horizontal line, the difference between their horizontal coordinates is the side length. Step 3.2 specifically includes: Step 3.21: If the side length between (x1, y1) and (x1, y2) is greater than or equal to two grid widths, extract all points with y1 as the vertical coordinate, subtract x1 from their horizontal coordinates respectively, and calculate the side length between the two points. Step 3.22: If the side length between (x2,y1) and (x1,y1) is greater than or equal to two grid widths, then determine the position of point (x2,y2). If it is within the area of the patch or on the boundary, mark that there is a rectangle with a side length of two grid widths or more within the patch.
2. The method for extracting linear slope patches with a width less than or equal to one grid cell according to claim 1, characterized in that, Step 2 specifically includes: Step 2.1: Extract the X and Y coordinates of all points in the polygon boundary nodes to obtain all combinations of X and Y coordinate values. Compare the coordinate values in the combinations with the existing boundary node coordinate values of the polygon to find the non-existent node coordinate pairs. Step 2.2: Determine the position of the non-existent node coordinate pair. If it is within the area or boundary of the current patch, add the node to the current patch set; otherwise, skip the step. Step 2.3: Repeat steps 2.1 and 2.2 until all the combined points have been traversed.
3. A system for extracting linear slope patches with a width less than or equal to one grid, characterized in that, The method for extracting linear slope patches with a width less than or equal to one grid, as described in any one of claims 1-2, includes: The coordinate information acquisition module traverses the patches in the slope grading map, generates a patch set, and acquires the coordinate information of all boundary nodes of each polygon. The coordinate point completion module calculates all coordinate point combinations based on the coordinate information of the boundary nodes of the polygon, compares them with the existing nodes, and completes all points. The graphic marking module searches for and marks rectangles with sides of two grid widths or more within the patch area. The map feature traversal module repeatedly runs the coordinate information acquisition module, the coordinate point completion module, and the graphic marking module until all map features have been traversed. The feature extraction module removes rectangular features with a width of two or more grid cells within the graphic, leaving linear slope features with a width of one grid cell or less.
4. A storage medium, characterized in that, The storage medium stores a computer program that, when run on a computer, causes the computer to perform a method for extracting linear slope patches with a width less than or equal to one grid, as described in any one of claims 1 to 2.