A method and device for quickly extracting the longest confluence path of a small watershed

By combining the depth-first search algorithm and the optimization starting point selection method, the balance problem of computing efficiency and result accuracy in large-scale complex river network data processing in the prior art is solved, and efficient maximum confluence path extraction is achieved, suitable for complex terrain and large-scale watershed analysis.

CN119357302BActive Publication Date: 2025-03-18POWER CHINA KUNMING ENG CORP LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411904774.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-03-18
Estimated Expiration
2044-12-23

AI Technical Summary

Technical Problem

When processing large-scale and complex river network data, the existing longest confluence path extraction technology is difficult to balance computing efficiency and result accuracy, and it is difficult to effectively integrate advanced algorithms and GIS spatial analysis technology.

Method used

Deep first search (DFS) algorithm is used to combine the optimization starting point selection method, and the efficiency of large-scale complex river network analysis is improved by organically combining graph theory algorithm with GIS technology.

Benefits of technology

It significantly improves the efficiency of large-scale complex river network analysis, especially when dealing with complex terrain and large-scale watershed analysis, it has broad application value, and significantly improves the convenience of user operations and processing speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357302B_ABST
    Figure CN119357302B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of hydrology and water resources, and in particular to a method and device for quickly extracting the longest confluence path of a small watershed. Through a unified interface, the generation of intermediate data is significantly reduced, so that the complexity of operations for users when performing complex hydrological analysis tasks is greatly reduced, and the possibility of data management errors and operational errors is reduced. The operation steps that users need to perform are simplified through an integrated processing flow. Flow direction analysis, flow calculation, river network extraction and the search for the longest confluence path are integrated in continuous steps, without the need for frequent tool switching, which significantly improves the convenience of user operation. The present invention optimizes the data processing algorithm, especially adopts the depth-first search (DFS) algorithm in the search for the longest runoff path, and improves the processing speed by organically combining the graph theory algorithm with the GIS technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of hydrology and water resources, and in particular to a method and device for quickly extracting the longest confluence path of a small watershed. Background Art

[0002] The extraction of the longest confluence path is a key issue in hydrological analysis and watershed feature identification, and is of great significance for water resources management, flood risk assessment, and watershed planning. In recent years, with the rapid development of geographic information system (GIS) technology and computer algorithms, significant progress has been made in this field. The traditional D8 algorithm based on digital elevation model (DEM) and its variants are still the main methods for extracting the longest confluence path, but researchers continue to improve and optimize it to improve its applicability and accuracy under complex terrain conditions.

[0003] At present, the longest confluence path extraction technology is developing towards a more accurate, efficient and intelligent direction. At the same time, the application of multi-source data fusion technology, such as combining high-resolution remote sensing images with DEM data, has significantly improved the accuracy of the extraction results. In addition, dynamic extraction methods that consider hydrological dynamics and seasonal changes have also begun to attract attention. These methods aim to better reflect the actual water flow conditions and the impact of environmental changes on the confluence path.

[0004] However, despite these advances, the longest confluence path extraction technology still faces many challenges. When dealing with large-scale and complex river network data, how to balance computational efficiency and result accuracy remains a key issue. In addition, how to effectively integrate advanced algorithms with GIS spatial analysis technology to give full play to the advantages of both is also a focus of current research.

[0005] In this context, the present invention, especially the depth-first search (DFS) algorithm and the optimized starting point selection method, represents an innovative attempt to address these challenges. By organically combining graph theory algorithms with GIS technology, this method shows potential in improving the efficiency of large-scale complex river network analysis. It has broad application value, especially when dealing with complex terrain and large-scale watershed analysis. Summary of the invention

[0006] To achieve the above object, the present invention provides the following technical solutions:

[0007] According to a first aspect of the present invention, the present invention claims a method for quickly extracting the longest confluence path of a small watershed, comprising:

[0008] Load DEM and outlet vector, and the user draws the analysis scope;

[0009] The DEM raster data is clipped, filled, flow direction analyzed, flow calculated, pour point captured, and watershed extracted to obtain the basin range raster data and converted into vector polygons;

[0010] Clip the flow raster and flow direction raster according to the watershed vector range, and filter out the river network raster data from the clipped flow direction raster data through the raster condition function;

[0011] Performing river network linking, river network analysis and vectorization processing on the river network raster data;

[0012] Determine the starting line segment and find the starting line segment closest to the specified outlet and with the largest grid_code in the river network;

[0013] Using the depth-first search DFS algorithm, starting from the selected starting line segment, the river network is traversed using the depth-first search algorithm to obtain the river network element set with the longest confluence path;

[0014] The polyline data of the longest confluence path is saved as a vector file and visualized on the map.

[0015] Furthermore, the method of loading the DEM and the outlet vector and the user drawing the analysis range also includes:

[0016] The user interactively defines the scope of analysis in the map and clips the base map DEM data according to this area, ensuring that the data set for subsequent processing only contains data from the relevant area;

[0017] The user specifies the geographic location of the outlet.

[0018] Furthermore, the DEM raster data is clipped, filled, flow direction analyzed, flow calculated, pour point captured, and watershed extracted to obtain the basin range raster data, and converted into vector polygons, which also includes:

[0019] Use the Fill tool to fill the DEM to eliminate depressions in the data and ensure the continuity of water flow. During the process, the system automatically sets the cell size and analysis range to ensure that the filling operation is performed accurately.

[0020] Use the Flow Direction tool to analyze the processed DEM data and determine the outflow direction of each raster;

[0021] Use the Flow Accumulation tool to process the flow direction data, calculate the cumulative flow into each grid, and identify areas where rivers may form;

[0022] According to the set snap distance, the Snap Pour Point tool is used to adjust the outlet position specified by the user to align it to the nearest high flow point to ensure the accuracy of the outlet position in the watershed analysis;

[0023] Use the Watershed tool to extract the watershed area based on the flow direction data and the adjusted outlet location, and obtain the raster data of the watershed as the direct input for river network extraction;

[0024] Use the IConversionOp.RasterDataToPolygonFeatureData method to convert the watershed raster data into vector polygons and output the calculated results to the Shapefile format of the specified path.

[0025] Furthermore, the method of clipping the flow raster and the flow direction raster according to the watershed vector range, and filtering the clipped flow direction raster data to obtain the river network raster data through the raster condition function, further includes:

[0026] Clip flow direction and flow raster data: Clip the generated flow raster and flow direction raster according to the vector polygon of the watershed to ensure that subsequent analysis only focuses on the specified watershed area;

[0027] River network grid extraction, apply the conditional function Con, set the threshold, filter out the grids above the set threshold from the clipped flow grid, and identify potential river network areas.

[0028] Furthermore, the river network linking, river network analysis and vectorization processing of the river network raster data further includes:

[0029] River network link: Use the StreamLink tool to process the river network grid after the conditional function is processed, and determine the link relationship of each river part in the river network based on the information of the flow direction grid;

[0030] River network classification: Execute the StreamOrder tool and use the Strahler method to classify the river network, determine the primary and secondary order of rivers, and ensure that the longest confluence path is found along the main stream;

[0031] River network vectorization: The results of river network classification are converted into vector format through the RasterToPolyline tool, and the raster data is converted into polyline vector data. The polyline vector data has the start and end points, direction and level information.

[0032] Furthermore, the determining of the starting line segment, finding the starting line segment closest to the designated water outlet and having the largest grid_code in the river network, further includes:

[0033] Before searching, check whether the fromcode and tocode fields already exist in the river network feature class. If not, call the AddFromToCodeFields function to add them. The fromcode and tocode fields are used to uniquely identify the starting point and end point of the river section.

[0034] Use the feature cursor to traverse all the features in the river network, and for each feature, obtain its shape polyline and extract the start and end points from it;

[0035] Convert the coordinates of the start and end points into string form and retain six decimal places. The coordinates are used as keys in the dictionary uniqueCoords, which stores the unique numbers of the coordinate points. Update the fromcode and tocode fields of each river section to correspond to the unique numbers of the start and end points respectively.

[0036] Determine the optimal starting segment: For each multi-segment, calculate its grid_code representing the flow size, and use the geometric interface IProximityOperator to calculate the shortest distance from the river section to the specified outlet pourPoint;

[0037] By comparison, the river section with the largest grid_code and the closest distance to the outlet is determined as the starting segment. If there are multiple river sections with the largest grid_code, the river section with the closest distance is selected as the starting segment.

[0038] Furthermore, the depth-first search DFS algorithm is used to traverse the river network from the selected starting line segment to obtain the river network element set of the longest confluence path, which also includes:

[0039] Construction of undirected graph: An undirected graph is constructed through the river network feature class riverFeatureClass to represent the topological structure of the river network. Each endpoint of the river section is converted into a node in the graph, and the river section itself serves as an edge connecting the nodes;

[0040] Initialization and search start: The selected starting segment and its endpoints are used as the starting point of DFS, the path list currentPath and the path length currentLength are initialized, and the starting segment is added to the path list, and the starting length is set to the length of the starting segment;

[0041] Starting from the starting node, recursively visit each adjacent node, that is, the connected river section, constantly update the current path and path length during the visit process, and maintain a visited node set visitedPoints;

[0042] During the traversal process, if visiting a new river section causes the path length to increase, the current path and length are updated. When no new nodes can be visited further, backtrack to the previous node and try other possible paths.

[0043] In each recursive call of the depth-first search, compare the current path length with the known longest path length. If the current path length is longer, update the longest path information and save the current path as the new longest path.

[0044] After completing DFS, the longest path recorded is returned as a set of river network features, representing the longest confluence path in the river network.

[0045] According to a second aspect of the present invention, the present invention claims a device for quickly extracting the longest confluence path of a small watershed, comprising:

[0046] one or more processors;

[0047] A memory having one or more programs stored thereon, when the one or more programs are executed by the one or more processors, the one or more processors implement the method for quickly extracting the longest confluence path of a small watershed.

[0048] The present invention relates to the technical field of hydrology and water resources, and in particular to a method and device for quickly extracting the longest confluence path for a small watershed. Through a unified interface and reducing the need for intermediate data, the complexity of operations for users when performing complex hydrological analysis tasks is greatly reduced, reducing the possibility of data management errors and operational errors. The integrated processing flow reduces the number of operational steps that users need to perform. Flow direction analysis, flow calculation, river network extraction, and the search for the longest confluence path are integrated into continuous steps without the need for frequent tool switching, which significantly improves the convenience of user operations. The present invention optimizes the data processing algorithm, especially uses algorithms in the calculation of flow accumulation and river network links, reduces unnecessary data reading and writing operations, and improves processing speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 A workflow diagram of a method for quickly extracting the longest confluence path in a small watershed as claimed in an embodiment of the present invention. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] The terms "first", "second" and "third" in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined as "first", "second" and "third" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. All directional indications (such as up, down, left, right, front, back...) in the embodiments of the present invention are only used to explain the relative position relationship, movement, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication also changes accordingly. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.

[0052] Reference to an "embodiment" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiment may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0053] Although existing GIS software such as ArcGIS provides hydrological analysis tools, these tools have many steps to operate and require high GIS operation skills from users, which increases the difficulty of learning and operation. In addition, a large amount of intermediate data needs to be generated and managed during the hydrological analysis process, which not only increases the workload of users, but also increases the possibility of errors.

[0054] The currently popular DEM hydrological analysis methods, especially when dealing with complex terrain and large-scale data, are often computationally inefficient. In particular, when using traditional algorithms such as D8 for flow direction and flow accumulation analysis, facing high-resolution and large-scale DEM data, the processing time is long and it is difficult to meet the needs of rapid response.

[0055] Existing DEM hydrological analysis tools are usually poorly integrated. When users conduct complex hydrological analysis such as the longest confluence path extraction, they often need to go through 7 to 8 different steps and frequently switch between different tools. This operational inconvenience increases the time consumption and operational complexity of the analysis process and reduces work efficiency.

[0056] According to the first embodiment of the present invention, the present invention claims a method for quickly extracting the longest confluence path of a small watershed, referring to Figure 1 ,include:

[0057] Load DEM and outlet vector, and the user draws the analysis scope;

[0058] The DEM raster data is clipped, filled, flow direction analyzed, flow calculated, pour point captured, and watershed extracted to obtain the basin range raster data and converted into vector polygons;

[0059] Clip the flow raster and flow direction raster according to the watershed vector range, and filter out the river network raster data from the clipped flow direction raster data through the raster condition function;

[0060] Performing river network linking, river network analysis and vectorization processing on the river network raster data;

[0061] Determine the starting line segment and find the starting line segment closest to the specified outlet and with the largest grid_code in the river network;

[0062] Using the depth-first search DFS algorithm, starting from the selected starting line segment, the river network is traversed using the depth-first search algorithm to obtain the river network element set with the longest confluence path;

[0063] The polyline data of the longest confluence path is saved as a vector file and visualized on the map.

[0064] Furthermore, the method of loading the DEM and the outlet vector and the user drawing the analysis range also includes:

[0065] The user interactively defines the scope of analysis in the map and clips the base map DEM data according to this area, ensuring that the data set for subsequent processing only contains data from the relevant area;

[0066] The user specifies the geographical location of the outlet to provide a basis for subsequent calculations.

[0067] Among them, in this embodiment:

[0068] The user draws the polygon of the analysis area on the map using the mouse, and double-clicking it triggers range storage.

[0069] The system uses ArcGIS's IExtractionOp interface to clip the base map DEM according to the polygon range defined by the user.

[0070] Users specify the geographic location of one or more outlets by clicking on the map or entering specific coordinates. These locations will serve as key starting points for hydrological simulation and river network extraction, especially when performing flow accumulation and pour point capture steps, these outlet locations provide necessary geographic information input.

[0071] Furthermore, the DEM raster data is clipped, filled, flow direction analyzed, flow calculated, pour point captured, and watershed extracted to obtain the basin range raster data, and converted into vector polygons, which also includes:

[0072] Use the Fill tool to fill the DEM to eliminate depressions in the data and ensure the continuity of water flow. During the process, the system automatically sets the cell size and analysis range to ensure that the filling operation is performed accurately.

[0073] Use the Flow Direction tool to analyze the processed DEM data and determine the outflow direction of each grid to ensure the correct setting of the flow direction;

[0074] Use the Flow Accumulation tool to process the flow direction data, calculate the cumulative flow into each grid, and identify areas where rivers may form;

[0075] According to the set snap distance, the Snap Pour Point tool is used to adjust the outlet position specified by the user to align it to the nearest high flow point to ensure the accuracy of the outlet position in the watershed analysis;

[0076] Use the Watershed tool to extract the watershed area based on the flow direction data and the adjusted outlet location, and obtain the raster data of the watershed as the direct input for river network extraction;

[0077] Use IConversionOp. RasterDataToPolygonFeatureData method to convert watershed raster data into vector polygons, output the calculated results to the Shapefile format of the specified path, and the converted polygons are used for further analysis and display in GIS.

[0078] In this embodiment, a standard flow analysis tool is used, but options such as D8, D∞, or MFD (multiple flow distribution) methods can be provided in parallel. These methods may perform better in different types of terrain. Users can choose the most suitable flow algorithm based on specific geographical and environmental characteristics.

[0079] Furthermore, the method of clipping the flow raster and the flow direction raster according to the watershed vector range, and filtering the clipped flow direction raster data to obtain the river network raster data through the raster condition function, further includes:

[0080] Clip flow direction and flow raster data: Clip the generated flow raster and flow direction raster according to the vector polygon of the watershed to ensure that subsequent analysis only focuses on the specified watershed area;

[0081] River network grid extraction, apply the conditional function Con, set the threshold, filter out the grids above the set threshold from the clipped flow grid, and identify potential river network areas.

[0082] In this embodiment, the river network is identified by setting a threshold (the default value of this method is 1000). Providing a threshold range (such as a percentage threshold of flow) for users to select or automatically adjusting according to terrain changes may be more suitable for processing DEM data of different sizes or different resolutions.

[0083] Furthermore, the river network linking, river network analysis and vectorization processing of the river network raster data further includes:

[0084] River network link: Use the StreamLink tool to process the river network grid after the conditional function is processed, and determine the link relationship of each river part in the river network based on the information of the flow direction grid;

[0085] River network classification: Execute the StreamOrder tool and use the Strahler method to classify the river network, determine the primary and secondary order of rivers, and ensure that the longest confluence path is found along the main stream;

[0086] River network vectorization: The results of river network classification are converted into vector format through the RasterToPolyline tool, and the raster data is converted into polyline vector data. The polyline vector data has the start and end points, direction and level information.

[0087] In this embodiment, the Strahler method is used for river network classification, and the Shreve or other river network classification methods may be provided in parallel, because different classification methods may be more suitable for different application scenarios or data characteristics.

[0088] Furthermore, the determining of the starting line segment, finding the starting line segment closest to the designated water outlet and having the largest grid_code in the river network, further includes:

[0089] Before searching, check whether the fromcode and tocode fields already exist in the river network feature class. If not, call the AddFromToCodeFields function to add them. The fromcode and tocode fields are used to uniquely identify the starting point and end point of the river section.

[0090] Use the feature cursor to traverse all the features in the river network, and for each feature, obtain its shape polyline and extract the start and end points from it;

[0091] Convert the coordinates of the start and end points into string form and retain six decimal places. The coordinates are used as keys in the dictionary uniqueCoords, which stores the unique numbers of the coordinate points. Update the fromcode and tocode fields of each river section to correspond to the unique numbers of the start and end points respectively.

[0092] Determine the optimal starting segment: For each multi-segment, calculate its grid_code representing the flow size, and use the geometric interface IProximityOperator to calculate the shortest distance from the river section to the specified outlet pourPoint;

[0093] By comparison, the river section with the largest grid_code and the closest distance to the outlet is determined as the starting segment. If there are multiple river sections with the largest grid_code, the river section with the closest distance is selected as the starting segment.

[0094] Furthermore, the depth-first search DFS algorithm is used to traverse the river network from the selected starting line segment to obtain the river network element set of the longest confluence path, which also includes:

[0095] Construction of undirected graph: An undirected graph is constructed through the river network feature class riverFeatureClass to represent the topological structure of the river network. Each endpoint of the river section is converted into a node in the graph, and the river section itself serves as an edge connecting the nodes;

[0096] Initialization and search start: The selected starting segment and its endpoints are used as the starting point of DFS, the path list currentPath and the path length currentLength are initialized, and the starting segment is added to the path list, and the starting length is set to the length of the starting segment;

[0097] Starting from the starting node, recursively visit each adjacent node, that is, the connected river section, and continuously update the current path and path length during the visit process. By maintaining a set of visited nodes visitedPoints, repeated visits are avoided to ensure search efficiency;

[0098] During the traversal process, if visiting a new river section causes the path length to increase, the current path and length are updated. When no new nodes can be visited further, backtrack to the previous node and try other possible paths.

[0099] In each recursive call of the depth-first search, compare the current path length with the known longest path length. If the current path length is longer, update the longest path information and save the current path as the new longest path.

[0100] After completing DFS, the longest path recorded is returned as a set of river network features, representing the longest confluence path in the river network.

[0101] The present invention greatly reduces the complexity of operations for users when performing complex hydrological analysis tasks through a unified interface and reduced need for intermediate data. This integrated design reduces the possibility of data management errors and operational errors.

[0102] The integrated processing flow reduces the number of steps required by users. For example, flow direction analysis, flow calculation, river network extraction, and longest confluence path search are integrated into a continuous process, eliminating the need to frequently switch tools, significantly improving the convenience of user operations.

[0103] In the experiment, using the traditional method to analyze a medium-sized DEM (about 1,000 square kilometers), the user needs to perform 7 to 8 steps, which takes an average of about 30-60 minutes; using the present invention, the same task is performed through an automated program, and the overall processing time is reduced to 3-5 minutes, and the efficiency is improved by about 1025%. The user satisfaction survey shows that after using the present invention, the user's score on the convenience of operation has increased by 40%, showing a significant improvement in user experience.

[0104] The present invention optimizes the data processing algorithm, especially adopts the algorithm in the calculation of flow accumulation and river network link, reduces unnecessary data reading and writing operations, and improves the processing speed.

[0105] When processing high-resolution DEM data (such as an area covering 100 square kilometers with a resolution of 1 meter), the traditional method takes an average processing time of more than 1 hour; the present invention shortens the processing time to about 10 minutes through algorithm optimization and parallel computing technology, and increases the processing speed by more than 6 times.

[0106] The above experimental data and technical effects show that the present invention not only solves the problems of complex operation and low efficiency of existing GIS tools, but also improves the adaptability and accuracy of hydrological analysis, and is particularly suitable for application scenarios that require rapid response and high-precision hydrological analysis.

[0107] According to a second embodiment of the present invention, the present invention claims a device for quickly extracting the longest confluence path of a small watershed, comprising:

[0108] one or more processors;

[0109] A memory having one or more programs stored thereon, when the one or more programs are executed by the one or more processors, the one or more processors implement the method for quickly extracting the longest confluence path of a small watershed.

[0110] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0111] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units. The above is only an implementation mode of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly used in other related technical fields, is also included in the patent protection scope of the present invention.

[0112] The specific implementation methods of the invention are described in detail above, but they are only examples, and the invention is not limited to the specific implementation methods described above. For those skilled in the art, any equivalent modification or substitution of the invention is also within the scope of the invention, therefore, the equalization, modification, improvement, etc. made without departing from the spirit and principle of the invention should be included in the scope of the invention.

Claims

1. A method for quickly extracting the longest confluence path of a small watershed, characterized in that: include: Load DEM and outlet vector, and the user draws the analysis scope; The DEM raster data is clipped, filled, flow direction analyzed, flow calculated, pour point captured, and watershed extracted to obtain the basin range raster data and converted into vector polygons; Clip the flow raster and flow direction raster according to the watershed vector range, and filter out the river network raster data from the clipped flow direction raster data through the raster condition function; Performing river network linking, river network analysis and vectorization processing on the river network raster data; Determine the starting line segment and find the starting line segment closest to the specified outlet and with the largest grid_code in the river network; Using the depth-first search DFS algorithm, starting from the selected starting line segment, the river network is traversed using the depth-first search algorithm to obtain the river network element set with the longest confluence path; Save the polyline data of the longest confluence path as a vector file and visualize it on the map; The DEM raster data is clipped, filled, flow direction analyzed, flow calculated, pour point captured, and watershed extracted to obtain the basin range raster data and converted into vector polygons, including: Use the Fill tool to fill the DEM to eliminate depressions in the data and ensure the continuity of water flow. During the process, the system automatically sets the cell size and analysis range to ensure that the filling operation is performed accurately. Use the Flow Direction tool to analyze the DEM data after the filling process to determine the outflow direction of each grid; Use the Flow Accumulation tool to process the flow direction data, calculate the cumulative flow into each grid, and identify areas where rivers may form; According to the set snap distance, the Snap Pour Point tool is used to adjust the outlet position specified by the user to align it to the nearest high flow point to ensure the accuracy of the outlet position in the watershed analysis; Use the Watershed tool to extract the watershed area based on the flow data and the adjusted outlet location, and obtain the watershed raster data as the direct input for river network extraction; Use IConversionOp. RasterDataToPolygonFeatureData method to convert watershed raster data into vector polygons, and output the calculated results to the Shapefile format of the user-specified path; The method further includes: clipping the flow raster and the flow direction raster according to the watershed vector range, and filtering the river network raster data from the clipped flow raster data through the raster condition function. Clipping flow direction and discharge raster data to watershed vector polygons reduces the scope of analysis; The conditional function Con is applied to set the threshold, and the grids with a value higher than the set threshold are selected from the clipped flow grids to identify the preliminary form of the river network. The performing of river network linking, river network analysis and vectorization processing on the river network raster data further includes: River network link: Use the StreamLink tool to process the river network grid after the conditional function is processed, and determine the link relationship of each river part in the river network based on the information of the flow direction grid; River network classification: Execute the StreamOrder tool to classify the river network using the Strahler method to determine the primary and secondary order of rivers, which is conducive to finding the longest confluence path along the main stream; River network vectorization: convert the river network classification results into vector format through the RasterToPolyline tool, and convert the raster data into multi-segment vector data, which contains the start and end points, direction and classification information; The determining of the starting line segment, finding the starting line segment closest to the designated water outlet and having the largest grid_code in the river network, further includes: Before searching, check whether the fromcode and tocode fields already exist in the river network feature class. If not, call to add them automatically. The fromcode and tocode fields are used to uniquely identify the starting point and end point of the river section. Use the feature cursor to traverse all the features in the river network. For each feature, obtain its shape polyline and extract the start and end point coordinates from it. Convert the coordinates of the start and end points into string form and retain six decimal places. The coordinates are used as keys in the dictionary uniqueCoords, which stores the unique numbers of the coordinate points. Update the fromcode and tocode fields of each river section to correspond to the unique numbers of the start and end points respectively. Determine the optimal starting segment: For each multi-segment, calculate its grid_code representing the flow size, and use the geometric interface IProximityOperator to calculate the shortest distance from the river section to the specified outlet pourPoint; By comparison, determine the river section with the largest grid_code and the closest distance to the outlet as the starting segment. If there are multiple river sections with the largest grid_code, select the river section with the closest distance as the starting segment. Using the depth-first search DFS algorithm, starting from the selected starting line segment, the river network is traversed using the depth-first search algorithm to obtain the river network element set of the longest confluence path, including: Construction of undirected graph: An undirected graph is constructed through the river network feature class riverFeatureClass to represent the topological structure of the river network. Each endpoint of the river section is converted into a node in the graph, and the river section itself serves as an edge connecting the nodes; Initialization and search start: The selected starting segment and its endpoints are used as the starting point of DFS, the path list currentPath and the path length currentLength are initialized, and the starting segment is added to the path list, and the starting length is set to the length of the starting segment; Starting from the starting node, recursively visit each adjacent node, that is, the connected river section, constantly update the current path and path length during the visit process, and maintain a visited node set visitedPoints; During the traversal process, if visiting a new river section causes the path length to increase, the current path and length are updated. When no new nodes can be visited further, backtrack to the previous node and try other possible paths. In each recursive call of the depth-first search, compare the current path length with the known longest path length. If the current path length is longer, update the longest path information and save the current path as the new longest path. After completing DFS, the longest path recorded is returned as a set of river network features, representing the longest confluence path in the river network.

2. A method for rapidly extracting the longest confluence path of a small watershed according to claim 1, characterized in that: The DEM and outlet vector are loaded, and the user draws the analysis scope, which also includes: The user interactively defines the scope of analysis in the map and clips the base map DEM data according to this area, ensuring that the data set for subsequent processing only contains data from the relevant area; The user specifies the geographic location of the outlet.

3. A rapid extraction device for the longest confluence path in a small watershed, characterized in that: include: one or more processors; A memory having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement a method for quickly extracting the longest confluence path for a small watershed according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • River network node degeneracy method based on depth-first search

    CN117312608A

  • River grading and river network convergence parallel computing method

    CN118536311A