Method and system for quality inspection of river flow direction contradiction and electronic equipment
By constructing a key-value pair data structure to automatically identify contradictions in river flow direction, the problem of low efficiency in quality inspection of river flow direction contradictions in existing technologies has been solved, achieving efficient and accurate identification of flow direction contradictions and improving data quality.
Patent Information
- Application Number
- CN202511712111.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-20
- Publication Date
- 2026-02-27
AI Technical Summary
Existing technologies are inefficient, have high rates of missed and false detections, and poor data consistency when quality inspection of conflicting river flow directions, especially in the quality inspection of large-scale vector data where automation is limited.
By constructing a key-value pair data structure, river element data is obtained based on a geographic information database. River vectors are parsed and key-value pair information is generated to identify nodes with conflicting flow directions. This includes obtaining the starting and ending points of river nodes and marking abnormal nodes according to preset conflicting flow directions.
It has achieved automated and high-precision identification of contradictions in river flow direction, quickly and accurately located logical errors in flow direction, improved the quality of vector data and the efficiency of data entry, and provided reliable support for data governance in geographic information systems.
Smart Images

Figure CN121579460A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of geographic data quality inspection, in particular to a method and system for quality inspection of river flow direction contradiction and electronic equipment. BACKGROUND
[0002] In the field of GIS (Geographic Information System) vector data quality inspection, the flow direction accuracy of directional linear features such as river networks is crucial, directly affecting the reliability of advanced applications such as water system connectivity analysis, hydrological simulation, and spatial analysis. Therefore, efficient and accurate quality inspection of flow direction contradiction in river vector data is one of the key links to ensure the quality of geographic spatial data.
[0003] Currently, the existing technical solutions in this field mainly include the following categories: the most traditional is the manual visual inspection method, that is, professional quality inspection personnel observe the symbolized flow direction or related attribute fields of each river in the GIS software environment and screen and judge one by one with the naked eye. In addition, there are also some automated attempts based on scripting tools, which develop scripting tools based on ArcPy in the ArcGIS platform to check the correctness of river vector collection direction in DLG data. It can also be analyzed through complex network analysis technology by constructing a river network model for connectivity analysis.
[0004] However, the above existing technical solutions have obvious limitations and defects. The manual visual inspection method is extremely inefficient, and its accuracy is highly dependent on the experience and concentration of personnel. When faced with massive data, it not only consumes time and effort, but also is prone to high false positive and false negative rates due to fatigue, and the data consistency is difficult to guarantee. The automated method based on scripting tools such as ArcPy can find the aggregation phenomenon of river endpoints to a certain extent, improving efficiency, but its core defect is that it cannot accurately understand the semantic logic of the flow direction, such as being unable to determine whether the river at the aggregation point is "relative", "opposite", or the correct "head-to-tail" relationship, so it will produce a large number of false positives and still needs manual verification, and the degree of automation is limited. As for network analysis and other methods, the configuration is usually complex and the computational overhead is huge, and the design focus is on complex hydrological analysis such as path simulation, rather than rapid quality inspection of flow direction contradiction, so it is not suitable for rapid screening and accurate positioning of large-scale vector data. SUMMARY
[0005] In view of the deficiencies in the prior art, the present application provides a method, system and electronic equipment for quality inspection of river flow direction contradiction, aiming to solve the problems of low efficiency, high false positive and false negative rates, and poor data consistency in quality inspection of river flow direction contradiction.
[0006] The present application discloses a method for quality inspection of river flow direction contradiction, comprising: Obtaining river element data based on a linear water system layer of a geographic information database; Performing analysis on the river element data to obtain at least one river vector, the river vector including a river direction, a river node, and a node type, the node type including a river start point and a river end point; Traversing the river vector to generate key-value pair information of the river node based on a preset data structure, the key-value pair information being used to represent start point information and end point information of the river node; According to a preset flow direction contradiction condition and the key-value pair information, identifying a flow direction contradiction node in the river node.
[0007] Preferably, the preset data structure includes key data and value data; The key data is used to store coordinate information, the coordinate information including horizontal coordinates and vertical coordinates of the river node in the linear water system layer; The value data includes a start point number, a start point geometric figure, an end point number, and an end point geometric figure corresponding to the river node.
[0008] Preferably, the key data is of a string type, and the value data is of a custom data structure.
[0009] Preferably, the traversing the river vector to generate the key-value pair information of the river node based on the preset data structure includes: Obtaining node coordinate information of the river node corresponding to each river vector, the node coordinate information including horizontal coordinates and vertical coordinates of the river node; Querying whether the node coordinate information exists in a river node dictionary, the river node dictionary being used to store the key-value pair information; In a case where the node coordinate information does not exist in the river node dictionary, newly creating the key-value pair information corresponding to the river node based on the preset data structure; Saving the key-value pair information corresponding to the river node in the river node dictionary.
[0010] Preferably, the newly creating the key-value pair information corresponding to the river node based on the preset data structure includes: Generating node key data according to the node coordinate information; Generating node value data according to the node type of the river node, including: if the river node is a river start point, setting a start point number to 1 and generating a start point geometric figure; if the river node is a river end point, setting an end point number to 1 and generating an end point geometric figure; Generating the key-value pair information corresponding to the river node based on the node key data and the node value data.
[0011] Preferably, the method for quality inspection of contradictions in river flow direction also includes: If the node coordinate information exists in the river node dictionary, query the key-value pair information corresponding to the node coordinate information; Updating the node value data based on the node type of the river node includes: If the river node is the starting point of the river, then increment the number of starting points by 1; If the river node is the end point of the river, then the number of the end points is incremented by 1.
[0012] Preferably, identifying contradictory error points in the river nodes based on preset flow direction contradictions and the key-value pair information includes: The number of starting points and ending points of the river nodes are obtained based on the key-value pair information; If the number of starting points and the number of ending points meet the preset flow direction contradiction situation, then the river node is marked as the flow direction contradiction node; If the number of starting points and the number of ending points do not conform to the preset flow direction contradiction, then the river node is marked as a node with normal flow direction.
[0013] Preferably, the preset flow direction contradiction situation includes a first situation and a second situation; The first case is used to characterize that in the key-value pair information of the river node, the number of starting points is greater than or equal to 2, and the number of ending points is 0; The second case is used to characterize the key-value pair information of the river node, where the number of endpoints is greater than or equal to 2, and the number of starting points is 0.
[0014] This invention also discloses a system for quality inspection of river flow direction discrepancies, used to execute the aforementioned method for quality inspection of river flow direction discrepancies. The system for quality inspection of river flow direction discrepancies includes: The data acquisition module is configured to acquire river feature data based on the linear water system layer of the geographic information database. The data parsing module is configured to: perform parsing on the river element data to obtain at least one river vector, the river vector including river direction, river nodes and node type, the node type including river start point and river end point; The key-value pair generation module is configured to: traverse the river vector and generate key-value pair information of the river node based on a preset data structure, wherein the key-value pair information is used to represent the starting point information and ending point information of the river node; The node quality inspection module is configured to identify conflicting nodes in the river flow based on preset flow direction conflict situations and the key-value pair information.
[0015] The present invention also discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement a method for quality inspection of contradictions in river flow direction.
[0016] Compared with existing technologies, the beneficial effects of this invention are as follows: By constructing a key-value pair data structure, this invention achieves automated and high-precision identification of contradictions in river flow direction. It can quickly and accurately locate flow direction logic errors in various directed line elements without human intervention, significantly improving the quality of vector data and the efficiency of data entry, and providing reliable technical support for geographic information system data governance and water system network analysis. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the method for quality inspection of contradictory river flow directions provided by the present invention. Figure 2 A first example diagram of river flow direction provided by the present invention; Figure 3 A second example diagram of river flow direction provided by the present invention; Figure 4 The third example diagram of river flow direction provided by the present invention; Figure 5 An example diagram illustrating incorrect river flow direction provided by this invention; Figure 6 This is a schematic diagram of the system provided by the present invention for detecting contradictions in river flow direction. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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, 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.
[0019] The present invention will now be described in further detail with reference to the accompanying drawings.
[0020] like Figure 1 As shown, this embodiment of the invention provides a method for quality inspection of contradictions in river flow direction, comprising the following steps: S1. Obtain river feature data based on the linear water system layer of the geographic information database.
[0021] In this embodiment of the invention, the geographic information database serves as an important carrier for storing geospatial data, and its linear river system layer contains rich river-related information. Through specific data access interfaces or query statements, river element data can be accurately extracted from this layer. This river element data covers various characteristic information of the rivers, providing a fundamental data source for subsequent quality inspection of flow direction discrepancies.
[0022] S2. Perform parsing on the river element data to obtain at least one river vector.
[0023] In this embodiment of the invention, specialized geographic information processing algorithms and tools are used to perform in-depth analysis of river element data. Through analysis, complex river element data can be decomposed into multiple river vectors. Each river vector includes river direction, river nodes, and node type; the node type includes river start point and river end point.
[0024] It should be noted that each river vector contains crucial information about the river's direction, clearly indicating its flow path. River nodes identify key locations within the river; the node type further clarifies whether the node represents the river's start or end point, laying the foundation for subsequent analysis of flow direction discrepancies based on this information.
[0025] For example, Figure 2 The three river vectors shown are river A, river B, and river C. River A starts at N and ends at P. River B starts at P and ends at M. River C starts at P and ends at Q. It is clear that river node P can be the end point of river A, or the starting point of both river B and river C.
[0026] S3. Traverse the river vector and generate key-value pair information of the river nodes based on the preset data structure.
[0027] In this embodiment of the invention, key-value pairs are used to characterize the start and end information of river nodes. The preset data structure includes key data and value data. The key data stores coordinate information, including the x and y coordinates of the river node on the linear river system layer. The value data includes the number of start points, the geometry of the start points, the number of end points, and the geometry of the end points corresponding to the river node.
[0028] In some embodiments, the key-value pair information is a key-value structure, where the key data is a string. The key data can be a concatenation of point coordinate strings with a value z, where z = x + y, where x is the x-coordinate of the river node, y is the y-coordinate of the river node, and z is the concatenation of the two strings. The value data is a custom data structure, including the number of starting points (FromPointCount), the geometry of the starting points (FromPointGeometry), the number of ending points (ToPointCount), and the geometry of the ending points (ToPointGeometry).
[0029] Specifically, the key data is associated with river nodes using horizontal and vertical axes. The value data of the river node represents the number of starting and ending points corresponding to that river node, while the geometric shape represents the spatial morphological characteristics of the river node when it is the endpoint. For example, Figure 2 The river node P in the example has 2 starting points and 1 ending point.
[0030] In the process of generating key-value pair information for river nodes based on a preset data structure, the node coordinate information of the river node corresponding to each river vector is first obtained. The node coordinate information includes the x-coordinate and y-coordinate of the river node. Next, the existence of node coordinate information is queried in the river node dictionary, which is used to store the key-value pair information.
[0031] If node coordinate information is missing in the river node dictionary, key-value pairs corresponding to the river nodes are created based on a preset data structure, and these key-value pairs are stored in the river node dictionary. Specifically, the process of creating key-value pairs for river nodes based on the preset data structure is as follows: Node key data is generated based on the node coordinate information; node value data is generated based on the node type of the river node. Specifically, if the river node is the starting point of the river, the number of starting points is set to 1, and the starting point geometry is generated; if the river node is the ending point of the river, the number of ending points is set to 1, and the ending point geometry is generated. Then, based on the node key data and node value data, the key-value pairs corresponding to the river nodes are generated.
[0032] If node coordinate information exists in the river node dictionary, query the key-value pairs corresponding to the node coordinate information, and update the node value data based on the node type of the river node. Specifically, update the number of starting points or ending points of the river node. If the river node is the starting point of the river, increment the number of starting points by 1. If the river node is the ending point of the river, increment the number of ending points by 1.
[0033] The following specific embodiment describes in detail the process of generating key-value pair information in this application of the present invention.
[0034] Linear water system layer such as Figure 2 As shown, traversal Figure 2 The river vectors in the data are used to extract the node coordinate information of the river nodes corresponding to each river vector. This includes the following: the x-coordinate of river node Q is 1 and the y-coordinate is 1; the x-coordinate of river node M is 5 and the y-coordinate is 1; the x-coordinate of river node P is 3 and the y-coordinate is 2; and the x-coordinate of river node N is 5 and the y-coordinate is 3.
[0035] For river node N based on river A, since river node N does not exist in the river node dictionary, a new key-value pair is created with the key data being (5+3). River node N is the starting point of the river, so the number of starting points is set to 1, and the starting point geometry is generated. For river node P based on river A, since river node P does not exist in the river node dictionary, a new key-value pair is created with the key data being (3+2). River node P is the ending point of the river, so the number of ending points is set to 1, and the ending point geometry is generated.
[0036] For river node P based on river B, if a key-value pair with key data (3+2) already exists in the river node dictionary, the node value data is updated. Since river node P is the starting point of river B, the starting point count is incremented by 1. At this point, river node P has 1 starting point and 1 ending point. For river node M based on river B, if this node does not exist in the river node dictionary, a new key-value pair is created with key data (5+1). River node M is the ending point of the river, the ending point count is set to 1, and the ending point geometry is generated.
[0037] For river node Q, which is not found in the river node dictionary for river C, a new key-value pair is created with the key (1+1). Since river node Q is the endpoint of river C, the endpoint count is set to 1, and the endpoint geometry is generated. For river node P, which is the starting point of river C, a key-value pair with the key (3+2) already exists in the river node dictionary. Therefore, the starting point count is incremented by 1. At this point, river node P has 2 starting points and 1 endpoint.
[0038] Based on the above steps, river A, river B, and river C are traversed, and key-value pair information of river nodes is generated.
[0039] S4. Based on the preset flow direction conflict situation and key-value pair information, identify the flow direction conflict nodes in the river nodes.
[0040] In this embodiment of the invention, the number of starting points and ending points of river nodes are obtained based on key-value pair information. If the number of starting points and ending points meets the preset flow direction contradiction condition, the river node is marked as a flow direction contradiction node; if the number of starting points and ending points does not meet the preset flow direction contradiction condition, the river node is marked as a flow direction normal node.
[0041] Specifically, the preset flow direction contradiction scenarios include a first scenario and a second scenario. The first scenario is used to characterize the key-value pair information of the river node where the number of starting points is greater than or equal to 2, and the number of ending points is 0. The second scenario is used to characterize the key-value pair information of the river node where the number of ending points is greater than or equal to 2, and the number of starting points is 0.
[0042] For example, such as Figure 2 As shown, river node P has 2 starting points and 1 ending point, which does not meet the preset flow direction contradiction condition; therefore, river node P is marked as a node with normal flow direction. River node M has 0 starting points and 1 ending point, which does not meet the preset flow direction contradiction condition; therefore, river node M is marked as a node with normal flow direction. River node Q has 0 starting points and 1 ending point, which does not meet the preset flow direction contradiction condition; therefore, river node Q is marked as a node with normal flow direction. River node N has 1 starting point and 0 ending points, which does not meet the preset flow direction contradiction condition; therefore, river node N is marked as a node with normal flow direction.
[0043] Thus, the method for quality inspection of river flow direction contradictions provided by the embodiments of the present invention can automatically identify and mark potential abnormal flow direction nodes in the river network through the key-value pair information of river nodes, and accurately and efficiently identify the flow direction contradiction problems existing in the river nodes.
[0044] For example, such as Figure 3 As shown, the number of starting points of river node V is 2 and the number of ending points is 0, which meets the first case in the preset flow direction contradiction situation. Therefore, river node V is marked as a flow direction contradiction node.
[0045] For example, such as Figure 4 As shown, the number of starting points of river node W is 0 and the number of ending points is 4, which meets the second case in the preset flow direction contradiction situation. Therefore, river node W is marked as a flow direction contradiction node.
[0046] Figure 5 More examples of flows to conflicting nodes are given. The process of determining flows to conflicting nodes is the same as the steps described above, and will not be repeated here.
[0047] In this embodiment of the invention, after obtaining the contradictory nodes of the river flow direction, the method further includes highlighting the contradictory nodes or generating anomaly reports, so that users can quickly locate and correct topological errors in the river network, thereby improving data quality and the accuracy of subsequent analysis.
[0048] like Figure 6As shown, this embodiment of the invention also provides a system for quality inspection of river flow direction discrepancies, used to execute the above-described method for quality inspection of river flow direction discrepancies. The system for quality inspection of river flow direction discrepancies includes: a data acquisition module 601, a data parsing module 602, a key-value pair generation module 603, and a node quality inspection module 604.
[0049] Specifically, the data acquisition module 601 is configured to acquire river element data based on a linear river system layer in a geographic information database. The data parsing module 602 is configured to parse the river element data to obtain at least one river vector, which includes river direction, river nodes, and node type, where the node type includes river start and river end points. The key-value pair generation module 603 is configured to traverse the river vectors and generate key-value pair information for the river nodes based on a preset data structure, where the key-value pair information represents the start and end point information of the river nodes. The node quality inspection module 604 is configured to identify nodes with conflicting flow directions among the river nodes based on preset flow direction inconsistencies and the key-value pair information.
[0050] This invention also provides an electronic 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, it implements a method for quality inspection of contradictions in river flow direction.
[0051] As can be seen from the above technical solutions, this invention discloses a method, system, and electronic device for quality inspection of river flow direction contradictions. The method includes: acquiring river element data based on a linear water system layer of a geographic information database; parsing the river element data to obtain at least one river vector; traversing the river vectors and generating key-value pair information for river nodes based on a preset data structure, wherein the key-value pair information is used to characterize the starting and ending information of the river nodes; and identifying the flow direction contradiction nodes in the river nodes according to the preset flow direction contradiction situation and the key-value pair information. This invention, by constructing a key-value pair data structure, achieves automated and high-precision identification of river flow direction contradictions. It can quickly and accurately locate flow direction logic errors in various directed linear elements without manual intervention, significantly improving vector data quality and database entry efficiency, and providing reliable technical support for geographic information system data governance and water system network analysis.
[0052] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for quality inspection of river flow direction contradiction, characterized in that, The method comprises the following steps: obtaining river element data based on a geographic information database-based linear water system layer; performing analysis on the river element data to obtain at least one river vector, the river vector comprising a river direction, a river node, and a node type, the node type comprising a river starting point and a river ending point; traversing the river vector to generate key-value pair information of the river node based on a preset data structure, the key-value pair information being used to represent starting point information and ending point information of the river node; identifying a flow direction contradiction node in the river node according to a preset flow direction contradiction condition and the key-value pair information.
2. The method for quality inspecting the contradiction of river flow direction according to claim 1, characterized in that, The preset data structure comprises key data and value data; the key data is used to store coordinate information, the coordinate information comprising horizontal coordinates and vertical coordinates of the river node in the linear water system layer; the value data comprises a starting point number, a starting point geometric figure, an ending point number, and an ending point geometric figure corresponding to the river node.
3. The method for quality inspecting the contradiction of river flow direction according to claim 2, characterized in that, The key data is of a string type, and the value data is of a custom data structure.
4. The method for quality inspecting the contradiction of river direction according to claim 2, characterized in that, The traversing of the river vector to generate the key-value pair information of the river node based on the preset data structure comprises the following steps: obtaining node coordinate information of the river node corresponding to each river vector, the node coordinate information comprising horizontal coordinates and vertical coordinates of the river node; querying whether the node coordinate information exists in a river node dictionary, the river node dictionary being used to store the key-value pair information; in a case where the node coordinate information does not exist in the river node dictionary, newly creating the key-value pair information corresponding to the river node based on the preset data structure; saving the key-value pair information corresponding to the river node in the river node dictionary.
5. The method for quality inspection of river flow direction contradiction according to claim 4, characterized in that, The newly creating of the key-value pair information corresponding to the river node based on the preset data structure comprises the following steps: generating node key data according to the node coordinate information; generating node value data according to the node type of the river node, comprising: if the river node is a river starting point, setting the starting point number to 1 and generating a starting point geometric figure; if the river node is a river ending point, setting the ending point number to 1 and generating an ending point geometric figure; generating the key-value pair information corresponding to the river node based on the node key data and the node value data.
6. The method for quality inspecting the contradiction of river direction according to claim 5, characterized in that, The method further comprises the following steps: in a case where the node coordinate information exists in the river node dictionary, querying the key-value pair information corresponding to the node coordinate information; updating the node value data based on the node type of the river node, comprising: if the river node is a river starting point, increasing the starting point number by 1; if the river node is a river ending point, increasing the ending point number by 1.
7. The method for quality inspecting the contradiction of river flow direction according to claim 1, characterized in that, The identifying of the contradiction error point in the river node according to the preset flow direction contradiction condition and the key-value pair information comprises the following steps: obtaining a starting point number and an ending point number of the river node based on the key-value pair information; if the starting point number and the ending point number meet the preset flow direction contradiction condition, marking the river node as the flow direction contradiction node; if the starting point number and the ending point number do not meet the preset flow direction contradiction condition, marking the river node as a flow direction normal node.
8. The method for quality inspecting the contradiction of river flow direction according to claim 7, characterized in that, The preset flow direction contradiction situation includes a first situation and a second situation. The first situation is used to represent that the number of the start points is greater than or equal to 2 and the number of the end points is 0 in the key-value pair information of the river node. The second situation is used to represent that the number of the end points is greater than or equal to 2 and the number of the start points is 0 in the key-value pair information of the river node.
9. A system for inspecting a contradiction of a river flow direction, for performing the method for inspecting a contradiction of a river flow direction according to any one of claims 1 to 8, characterized by, The method comprises the following steps: The data acquisition module is configured to acquire river element data based on a linear water system layer of a geographic information database; The data analysis module is configured to perform analysis on the river element data to acquire at least one river vector, wherein the river vector comprises a river direction, a river node and a node type, and the node type comprises a river start point and a river end point; The key-value pair generation module is configured to traverse the river vector and generate key-value pair information of the river node based on a preset data structure, wherein the key-value pair information is used to represent start point information and end point information of the river node; The node quality inspection module is configured to identify a flow direction contradiction node in the river node according to a preset flow direction contradiction situation and the key-value pair information.
10. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the method for inspecting river flow direction contradiction according to any one of claims 1-8.