Drainage system CAD-GIS data conversion and standard marking method and device

By using automated conversion methods, CAD data of municipal drainage systems is converted into GIS data, solving the problem of time-consuming manual input and achieving efficient data entry and standardized labeling.

CN115906360BActive Publication Date: 2026-01-23ZHONGSHAN TORCH WATER CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211589678.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-12
Publication Date
2026-01-23
Estimated Expiration
2042-12-12

AI Technical Summary

Technical Problem

Converting CAD drawings of municipal drainage pipe networks into GIS data requires manual input, resulting in high labor costs, impacting daily maintenance and management, and being time-consuming.

Method used

An automated method is used to analyze CAD data, extract and generate directed graph structure data, use KDTree to search tree structure data to filter text annotations, and convert it into shapefile data to achieve automatic annotation and data placement of inspection wells and pipelines.

Benefits of technology

It significantly improves the efficiency of entering information on manhole and pipeline drawings, which can be completed in just one to several weeks within a 50km2 area, reducing labor costs and time consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115906360B_ABST
    Figure CN115906360B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of municipal drainage pipe network, and particularly relates to a drainage system CAD-GIS data conversion and standard marking method, which comprises the following steps: analyzing CAD data and extracting, extracting data in CAD according to types, and storing text files; processing CAD data, generating directed graph structure data from the extracted CAD data, generating KDTree search tree structure data from the X and Y positions of the text marking, filtering and finding the text near the midpoint of the preset inspection well or pipeline to obtain correct text marking content; converting the elevation text into real elevation, and obtaining the start point and end point elevation data of the preset inspection well, using the directed graph data structure and the extracted elevation data of the preset inspection well to analyze and sort the pipeline elevation and pipe diameter data; and converting into shp data. The method can greatly improve the information input efficiency of the drawing of the inspection well and the pipeline, and standardize the marking.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the municipal drainage pipe network technical field, more particularly, particularly relates to a kind of municipal drainage system CAD-GIS system data automatic conversion method and device. BACKGROUND

[0002] The most important data of current municipal drainage pipe network, one is the elevation, pipe diameter data of pipe network, two is the topological structure data of pipe network, above-mentioned two kinds of data can correctly reflect reality, is the fundamental of routine operation maintenance management.In the construction period of municipal drainage pipe network, CAD drawing is important data.But in routine maintenance operation, CAD drawing is quite inconvenient to look up.In order to facilitate the look-up of drawing, CAD drawing data needs to be converted into GIS system data, and CAD data is usually converted into GIS data by manual operation, and elevation, pipe diameter and other data are manually input into GIS data, and in general area 50Km 2 There are tens of thousands of inspection wells and pipelines in the drainage pipe network system, and it takes about half a year to a year to manually input information, which not only causes high labor cost, but also greatly affects the drawing look-up of routine maintenance of municipal drainage pipe network, and is not conducive to the comprehensive management of municipal drainage pipe network. SUMMARY

[0003] The present application is to overcome the above-mentioned situation, and aims to provide a kind of municipal drainage system CAD-GIS system data automatic conversion method and device.

[0004] According to the first aspect of the present application, a kind of drainage system CAD-GIS data conversion and standard marking method is provided, comprising:

[0005] Analysis CAD data and extraction, according to type extraction, and store text file in CAD data;

[0006] Processing CAD data, generating directed graph structure data from the extracted CAD data, generating KDTree search tree structure data from the X, Y position of the text annotation, filtering and finding the text near the preset inspection well or pipeline midpoint to obtain the correct text annotation content;Convert elevation text into real elevation, and obtain the bottom and ground elevation and number of the preset inspection well, and analyze and arrange the elevation, pipe diameter data of pipeline starting point and endpoint;

[0007] Convert into shp data.

[0008] Further, the data in AUTOCAD is extracted according to block, text and straight line three types by using the data extraction function in AUTOCAD.

[0009] Further, for the inspection well without the data of the cad of the annotation of the lead-out line, the data extraction and conversion process is as follows:

[0010] First, according to the selected CAD pipeline data, the NetworkX program algorithm is applied to generate the directed graph structure data of the drainage pipe network, and the pipe network topology is completely extracted;

[0011] Second, using the neighbor search algorithm in scipy.spatial, the X and Y positions of the text annotations are generated into KDTree search tree structure data;

[0012] Third, using the KDTree.query method of the search tree structure data to preset the text near the inspection well or pipeline midpoint;

[0013] Fourth, the correct text annotation content is found by filtering with regular expressions;

[0014] Fifth, the elevation text is converted to real elevation, the smallest data in the data is set as the well bottom elevation and the largest is set as the well top elevation, and the other elevation data is set as the elevation data;

[0015] Sixth, using the KDTree.query method of the search tree structure data, the inspection wells and numbered texts with similar distances are extracted into two different graph data structures, and then the concept of graph isomorphism is used to one-to-one correspondence between the inspection wells and the numbered texts, so that the numbering is automatically aligned;

[0016] Seventh, using the elevation data determined in the fifth step and the directed graph structure data of the drainage pipe network determined in the first step, the end point inspection well of the preset inspection well is obtained by applying the postorder adjacency point algorithm of the directed graph, and the elevation data of the start point and end point inspection wells is obtained;

[0017] Eighth, the text near the pipeline midpoint is obtained to obtain the pipe diameter and pipe material information;

[0018] Ninth, the start point and end point elevation data are regarded as two sets, denoted as m and n data respectively, the Cartesian product of the sets is performed to obtain m*n data pairs; the absolute value of the difference of the obtained data pairs is calculated, and the elevation data pair with the minimum absolute value is recorded as the elevation of the start point and end point of the pipeline;

[0019] The third to fifth steps are performed for each inspection well to obtain the various elevations and numbers of each inspection well, and then the seventh to ninth steps are performed to correctly parse and align the pipeline elevation, pipe diameter, and other data.

[0020] Further, for the CAD with inspection well with lead line annotation data, the data extraction and conversion process is:

[0021] First, according to the selected CAD pipeline data, the NetworkX program algorithm is applied to generate the directed graph structure data of the drainage pipe network, and the pipe network topology is completely extracted;

[0022] Second step, using the nearest search algorithm in scipy.spatial, generate KDTree search tree structure data for the X, Y position of the lead line and the X, Y position of the text label respectively;

[0023] Third step, use the KDTree.query method of the search tree structure data to find the lead line near the preset inspection well;

[0024] Fourth step, judge the mode of the lead line, whether it belongs to single baseline lead line or double baseline lead line, and get the midpoint of each baseline;

[0025] Fifth step, search for the text near the midpoint of each baseline and get the text by using the text KDTree search tree structure data; find the correct text label content by regular expression filtering;

[0026] Sixth step, convert the elevation text into real elevation, set the smallest one as the well bottom elevation and the largest one as the well top elevation, and set the other elevation data as the preset inspection well elevation data;

[0027] Seventh step, classify the numbered text as the preset inspection well;

[0028] Eighth step, use the elevation data determined in the sixth step and the directed graph structure data of the drainage pipe network determined in the first step, apply the postorder traversal algorithm of the directed graph point to get the endpoint inspection well of the preset inspection well, and get the elevation data of the start point and endpoint inspection wells;

[0029] Ninth step, take the elevation data of the start point and endpoint inspection wells as two sets, denoted as m and n data respectively, perform Cartesian product of the sets, get m*n data pairs; take the absolute value of the difference of the data pairs, and the elevation data pair with the minimum absolute value is the elevation of the start point and endpoint of the pipeline;

[0030] Perform the third step to the sixth step on the inspection wells to get the various types of elevation and number of each inspection well, and then perform the eighth step to the ninth step to correctly parse and locate the pipeline elevation, pipe diameter and other data.

[0031] Further, for the cad with standard annotation data block of the inspection well, the data extraction and conversion process is:

[0032] First step, generate the directed graph structure data of the drainage pipe network by applying the algorithm of NetworkX program according to the selected CAD pipeline data, and completely extract the pipe network topology;

[0033] Second step, using the nearest search algorithm in scipy.spatial, generate KDTree search tree structure data for the X, Y position of the lead line label block;

[0034] Thirdly, the KDTree.query method of the search tree structure data is used to find the lead line marking block near the preset inspection well;

[0035] Fourthly, attribute data in the lead line marking block is read to determine the well top, well bottom elevation and pipeline elevation data connected with the inspection well, and to obtain the number data;

[0036] Fifthly, the elevation data determined in the fourth step and the directed graph structure data of the drainage pipe network determined in the first step are used to obtain the endpoint inspection well of the preset inspection well by using the postorder traversal algorithm of the directed graph point, so that the elevation data of the start point and the endpoint inspection well are obtained;

[0037] Sixthly, the elevation data of the start point and the endpoint inspection well are regarded as two sets, denoted as m and n data respectively, the Cartesian product of the sets is obtained, m*n data pairs are obtained, the absolute value of the difference of the data pairs is calculated, and the elevation data pair with the minimum absolute value is the elevation data of the start point and the endpoint of the pipeline;

[0038] The third step to the fourth step are performed on each inspection well to obtain various elevations and numbers of each inspection well, and then the fifth step to the sixth step are performed to correctly parse and arrange the pipeline elevation, pipe diameter and other data.

[0039] Further, after the data is extracted from the CAD and the structured data is stored, the following steps are used to convert the structured data into shp data:

[0040] Firstly, the Proj module of the pyproj program is applied, parameters are set according to the coordinate system used in the CAD drawing, and the X and Y coordinates of the extracted data are converted into Web Mercator X and Y coordinates, which are used for display in the geographic information system;

[0041] Secondly, the algorithm of the osgeo program is applied to create layers, create geometric elements, create attributes of the geometric elements, and write data to generate shp files.

[0042] According to the second aspect of the present application, a drainage system CAD-GIS data conversion and standard marking device is provided, comprising:

[0043] A CAD data analysis and extraction module is used to extract data in the CAD according to types and store text files;

[0044] a CAD data processing module, configured to generate directed graph structure data from the extracted CAD data, generate KDTree search tree structure data from the X and Y positions of the text labels, filter and find the text labels near the preset inspection wells or pipeline midpoints to obtain correct text label content, and convert the elevation text into real elevation to obtain the elevation and number of the inspection well bottom and ground, and parse the elevation, pipe diameter, and other data of the pipeline start and end points.

[0045] a shp data conversion module.

[0046] Further, the CAD data processing module is configured to process the cad of the inspection well without the lead line label data, and the data extraction and conversion process is as follows:

[0047] According to the selected CAD pipeline data, the NetworkX program algorithm is used to generate the directed graph structure data of the drainage pipe network and completely extract the pipe network topology;

[0048] The X and Y positions of the text labels are generated into KDTree search tree structure data by using the neighbor search algorithm in scipy.spatial.

[0049] The KDTree.query method of the search tree structure data is used to search for the text near the preset inspection wells or pipeline midpoints.

[0050] The correct text label content is found by filtering with a regular expression; the elevation text is converted into real elevation, the smallest data in the data is set as the well bottom elevation, the largest data is set as the well top elevation, and the other elevation data is set as the elevation data.

[0051] The KDTree.query method of the search tree structure data is used to extract the inspection wells and numbered text with similar distances into two different graph data structures, and then the concept of graph isomorphism is used to one-to-one correspond the inspection wells and numbered text, so that the automatic positioning of the number is achieved.

[0052] The determined elevation data and the determined directed graph structure data of the drainage pipe network are used to apply the postorder adjacency point algorithm of the directed graph to obtain the end point inspection well of the preset inspection well, and obtain the elevation data of the start point and end point inspection wells; the start point and end point elevation data are regarded as two sets, each with m and n data, and the Cartesian product of the sets is obtained to obtain m*n data pairs; the absolute value of the difference of the obtained data pairs is calculated, and the elevation data pair with the minimum absolute value is recorded as the elevation of the start point and end point of the pipeline; the various types of elevation and number of each inspection well are obtained, and the pipeline elevation, pipe diameter, and other data are correctly parsed and positioned.

[0053] Further, the CAD data processing module is configured to process the cad of the inspection well with the lead line label data, and the data extraction and conversion process is as follows:

[0054] According to the data of the selected CAD pipeline, the algorithm of the NetworkX program is applied to generate the directed graph structure data of the drainage pipe network, and the topological structure of the pipe network is completely extracted;

[0055] The X and Y positions of the lead-out line and the X and Y positions of the text label are used to generate KDTree search tree structure data by using the nearest neighbor search algorithm in scipy.spatial;

[0056] The KDTree.query method of the search tree structure data is used to find the lead-out line near the preset inspection well; the mode of the lead-out line is judged, and the midpoint of each baseline is obtained, which belongs to single baseline lead-out line or double baseline lead-out line;

[0057] The text near the midpoint of each baseline is searched and obtained by using the text KDTree search tree structure data; the correct text label content is found by filtering through a regular expression; the elevation text is converted into a real elevation, the smallest one in the data is set as the well bottom elevation and the largest one is set as the well top elevation, and the other elevation data is set as the elevation data; and the number data is obtained;

[0058] The elevation data determined in the sixth step and the directed graph structure data of the drainage pipe network determined in the first step are used to apply the postorder traversal algorithm of the directed graph point to obtain the endpoint inspection well of the preset inspection well, and the elevation data of the starting point and the endpoint are obtained;

[0059] The starting point and endpoint elevation data are regarded as two sets, each having m and n data, respectively, the Cartesian product of the sets is obtained, m*n data pairs are obtained, the absolute value of the difference of the obtained data pairs is calculated, and the elevation data pair with the minimum absolute value is the elevation of the starting point and endpoint inspection wells of the pipeline; various types of elevations and numbers of each inspection well are obtained, and the pipeline elevation, pipe diameter and other data are correctly parsed and placed.

[0060] Further, the CAD data processing module is used to process the cad with standard label data block of the inspection well, and the data extraction and conversion process is:

[0061] According to the data of the selected CAD pipeline, the algorithm of the NetworkX program is applied to generate the directed graph structure data of the drainage pipe network, and the topological structure of the pipe network is completely extracted;

[0062] The X and Y positions of the lead-out line label block are used to generate KDTree search tree structure data by using the nearest neighbor search algorithm in scipy.spatial;

[0063] The KDTree.query method of the search tree structure data is used to find a lead line marking block near the preset inspection well; attribute data in the lead line marking block is read to determine well top, well bottom elevation and pipeline elevation data connected with the inspection well; and number data is obtained;

[0064] Using the determined elevation data and the determined directed graph structure data of the drainage pipe network, the postorder traversal algorithm of the directed graph point is applied to obtain an endpoint inspection well of the preset inspection well, to obtain elevation data of the two inspection wells of the start point and the endpoint; the start point and the endpoint elevation data are regarded as two sets, denoted as m and n data respectively, the Cartesian product of the sets is performed to obtain m*n data pairs; the absolute value of the difference of the obtained data pairs is calculated, and the elevation data pair with the minimum absolute value is the elevation of the start point and the endpoint of the pipeline; various elevations and numbers of the inspection wells are obtained, and the pipeline elevation, pipe diameter and other data are correctly parsed and positioned.

[0065] According to a third aspect of the present application, a computer device is provided, comprising a memory and a processor, the memory stores a computer program, and the processor implements the steps of the drainage system CAD-GIS data conversion and standard marking method of the first aspect of the present application when executing the computer program.

[0066] According to a fourth aspect of the present application, a computer storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the drainage system CAD-GIS data conversion and standard marking method of the first aspect of the present application.

[0067] Compared with the prior art, the present application has the following beneficial effects:

[0068] Using the drainage system CAD-GIS data conversion and standard marking method, the information input efficiency of the inspection well and the pipeline drawing can be greatly improved, and the standard marking can be performed; for example, the drainage pipe network system with an area of 50Km 2 The information input work can be completed in one week to several weeks by using the method, and the input work can be completed in a few minutes, and the other time is mainly used to check whether the input is correct. BRIEF DESCRIPTION OF DRAWINGS

[0069] The accompanying drawings are used to provide a further understanding of the present application, and constitute a part of the specification, and are used to explain the present application together with embodiments of the present application, and do not constitute a limitation to the present application. In the drawings:

[0070] Figure 1 is a schematic diagram of the steps of the drainage system CAD-GIS data conversion and standard marking method in the embodiments of the present application.

[0071] Figure 2 is a schematic diagram of the cad data of the standard marking data. DETAILED DESCRIPTION

[0072] It should be noted that the embodiments and features of the embodiments in the present application can be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.

[0073] In order for those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings and in conjunction with the embodiments. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present application.

[0074] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0075] The embodiment of the present application provides a drainage system CAD-GIS data conversion and standard annotation method, as shown in Figure 1

[0076] Specifically includes the following steps:

[0077] Analyze CAD data and extract, extract data in CAD according to type, and store text file;

[0078] Process CAD data, generate graph-oriented structure data from the extracted CAD data, generate KDTree search tree structure data from the X and Y positions of the text annotation, filter and find the text near the preset inspection well or pipeline midpoint to obtain the correct text annotation content, convert the elevation text into real elevation, and obtain the elevation and number of the bottom of the preset inspection well and the ground, and analyze and arrange the elevation, pipe diameter data of the starting point and end point of the pipeline;

[0079] Convert to shp data.

[0080] ​Specifically, in the CAD drawing, the block corresponds to the inspection well, the line corresponds to the pipeline, the labeled text corresponds to the elevation, the pipe diameter and other texts, and there is no data structure relationship between the block, the line and the labeled text. Only the relationship between the point, the line and the labeled text is presented through the distance or the labeled lead line. The shp file is an open format of spatial data and is a vector graphics format. The format file is mainly used for describing geometric objects such as points, polylines and polygons. The position and related attributes of the geometric graphics can be saved, and the data can be inter-operated between the products of most GIS companies. The purpose of the present application is to convert the position of the geometric graphics and the related data of the label in the CAD of the drainage pipe network system into the position and related attributes of the geometric graphics in the shp file, so as to improve the input efficiency of the information of the inspection well and the pipeline CAD drawing.

[0081] Specifically, the CAD data is analyzed and extracted, the CAD data file is prepared, the data extraction function in AUTOCAD is applied, the data in the CAD drawing is extracted according to three types of blocks, texts and straight lines, and is stored as a text file. The information to be extracted in the CAD text file is shown in Table 1:

[0082] Table 1: CAD individual graphic element information extraction content

[0083] Block Name Layer Position X Position Y Position Z Straight line Length Layer Start point X Start point Y Start point Z End point X End point Y End point Z Text Name Layer Position X Position Y Content

[0084] For the AUTOCAD drawing, the text information is near the graphic element such as block or straight line, or is labeled by lead line, which is the basis for converting the CAD into the shp file in the method. Specifically, in the CAD drawing of the drainage system, the inspection well is generally generated by the block insertion method, the pipeline is a polyline or a straight line, and the elevation and length of the general inspection well and pipeline are labeled by text. The text label is generally near the midpoint of the block or the pipeline, or is labeled by the lead line.

[0085] Specifically, for the inspection well without lead line labeled data of the CAD, the extraction and conversion process includes the following steps:

[0086] Firstly, the algorithm of the NetworkX program is applied according to the selected CAD pipeline data to generate the directed graph structure data of the drainage pipe network, and the topological structure of the pipe network is ensured to be complete and extracted. The algorithm of the NetworkX program is a python existing program module;

[0087] Secondly, the X and Y positions of the text label are generated by using the neighbor search algorithm in scipy.spatial to generate the KDTree search tree structure data. The neighbor search algorithm in scipy.spatial is a python existing program module;

[0088] Third step, search the text near the midpoint of the inspection well or pipeline by KDTree.query method of search tree structure data; "no lead line text tolerance" in the program operation interface refers to the distance between the inspection well and the text, and the text within the above distance range is searched; KDTree.query method is a python existing program module;

[0089] Fourth step, filter the correct text annotation content by regular expression;

[0090] Fifth step, convert the elevation text into real elevation, set the minimum data in the data as the well bottom elevation and the maximum data as the well top elevation, and set the other elevation data as the preset inspection well elevation data;

[0091] Sixth step, use KDTree.query method of search tree structure data to extract the inspection well and numbered text with similar distances as two different graph data structures, and then use the concept of graph isomorphism to correspond the inspection well and numbered text one by one, so as to realize the automatic positioning of the number;

[0092] Seventh step, use the elevation data determined in the fifth step and the directed graph structure data of the drainage pipe network determined in the first step, and apply the postorder adjacency point algorithm of directed graph to find the end point inspection well of the inspection well, and obtain the elevation data of the start point and end point inspection wells; the postorder adjacency point algorithm is a python existing program module;

[0093] Eighth step, obtain the pipe diameter and pipe material information near the midpoint of the pipeline;

[0094] Ninth step, consider the elevation data of the start point and end point inspection wells as two sets, for example, two sets have m and n data respectively, perform Cartesian product of the sets, obtain m*n data pairs, then calculate the absolute value of the difference of the data pairs, and the elevation data pair with the minimum absolute value is the elevation of the start point and end point of the pipeline. This innovation point can be effectively used because it uses the following characteristics of the drainage pipe network: the elevation difference of the pipeline between the adjacent two inspection wells should be the smallest, and nearly 95% or more comply with this rule, so the correct extraction can be performed.

[0095] Some pipelines that do not meet the above conditions are corrected by the following method: when the start point elevation of the pipeline obtained by the above method exceeds the bottom elevation of the start point inspection well by more than 0.5m, it is considered that the pipeline is not suitable for this method; however, the bottom elevation of the start point inspection well is taken as the start point elevation of the pipeline, and the end point elevation is taken as the data closest to the bottom elevation of the start point inspection well. After checking by this method, nearly 99% of the data can be correctly positioned. If it still cannot be correctly positioned, there may be defects such as inverted slope in the pipe network.

[0096] Steps three through five are performed on each manhole to obtain its various elevations and numbers. Then, steps seven through nine are performed to correctly parse and assign pipeline elevations, pipe diameters, and other data. This completes the process of extracting manhole labeling data without lead-out lines.

[0097] Specifically, for CAD data of inspection wells with leader line markings, the data extraction and transformation process includes the following steps:

[0098] The first step is to use the NetworkX program's algorithm to generate directed graph structure data of the drainage network based on the selected CAD pipeline data, ensuring that the network topology is extracted completely.

[0099] The second step is to use the nearest neighbor search algorithm in scipy.spatial to generate KDTree search tree structure data for the X and Y positions of the leader line, and also generate KDTree search tree structure data for the X and Y positions of the text labels.

[0100] The third step is to use the KDTree.query method of the search tree structure data to find the lead-out line near a certain inspection well; there are generally two ways to set up an inspection well lead-out line: single baseline lead-out line and double baseline lead-out line;

[0101] The fourth step is to determine whether the leader line is a single baseline or a double baseline leader line, and then find the midpoint of each baseline accordingly.

[0102] The fifth step is to use the KDTree search tree structure data to search for and obtain text near the midpoint. The "text tolerance with leader line" in the program operation interface refers to the distance between the midpoint of the horizontal line and the text. Only text within this range is searched. The correct text annotation content is found by filtering with regular expressions.

[0103] The sixth step is to convert the text elevation data into real elevation data, designate the smallest data as the bottom elevation and the largest data as the top elevation, and designate the other elevation data as the preset inspection well elevation data.

[0104] Step 7: Assign the numbered text to the pre-set inspection well;

[0105] Step 8: Using the elevation data determined in step 6 and the directed graph structure data of the drainage network determined in step 1, apply the post-order traversal algorithm of the directed graph points to find the endpoint manhole of the manhole, and obtain the elevation data of the starting point and the endpoint manholes.

[0106] Step nine involves treating the elevation data of the starting and ending manholes as two sets, each with m and n data points respectively. Then, the Cartesian product of these sets is performed, resulting in m*n data pairs. The absolute difference between these pairs is then calculated; the pair with the smallest absolute difference is the elevation of the starting and ending points of the pipeline. This step leverages the following characteristic of drainage networks: the elevation difference between adjacent manholes should be minimal. Since this rule is met in over 95% of cases, accurate extraction is possible. Assigning the correct elevation data from the manholes to the pipelines, especially when two or more pipelines intersect, is crucial for obtaining the elevations of the pipeline's starting and ending points.

[0107] For pipelines that do not meet this condition, the following method can be used for correction: If the difference between the pipeline starting elevation obtained by the above method and the bottom elevation of the starting manhole exceeds 0.5m, the pipeline is considered unsuitable for this method of repositioning; however, the bottom elevation of the starting manhole is taken as the pipeline starting elevation, and the pipeline endpoint elevation is taken as the data closest to the bottom elevation of the starting manhole among the endpoint elevation data. After verification using this method, nearly 99% of the data can be correctly repositioned. If it still cannot be correctly repositioned, it may be due to defects such as reverse slope in the pipeline network itself.

[0108] Steps three through six are performed on each manhole to obtain its various elevations and numbers. Then, steps eight and nine are performed to correctly parse and assign data such as pipeline elevation and diameter. This completes the process of extracting the manhole label data.

[0109] The fourth step mentioned above is also crucial for the smooth execution of this CAD conversion program. The various formats of leader line annotations can significantly impact program efficiency and may result in the inability to extract correct information. Therefore, it is advisable to request specific formats for the leader line annotations, such as... Figure 2 As shown, it is inserted into the inspection well as a block with attributes, which makes the conversion of CAD data to shp files more convenient, efficient and accurate.

[0110] Specifically, for CAD drawings of inspection wells with standard labeled data blocks, the data extraction and transformation process includes the following steps:

[0111] The first step is to use the NetworkX program's algorithm to generate directed graph structure data of the drainage network based on the selected CAD pipeline data, ensuring that the network topology is extracted completely.

[0112] The second step is to use the nearest neighbor search algorithm in scipy.spatial to generate KDTree search tree structure data from the X and Y positions of the leader line labeled block;

[0113] The third step is to use the KDTree.query method of the search tree structure data to find the leader line label block near a certain inspection well;

[0114] The fourth step is to read the attribute data in the leader line label block to determine the elevation data and number data of the well top, well bottom, and pipeline connected to the inspection well.

[0115] The fifth step involves using the elevation data determined in the fourth step and the directed graph structure data of the drainage network determined in the first step to find the endpoint manhole of the manhole by applying the post-order traversal algorithm of the directed graph points, and obtaining the elevation data of the starting point and the endpoint.

[0116] The sixth step involves treating the elevation data of the two manholes at the start and end points as two sets, each containing m and n data points respectively. Then, the Cartesian product of these sets is performed, resulting in m*n data pairs. The absolute difference between these pairs is then calculated; the elevation pair with the smallest absolute difference is the elevation of the start and end points of the pipeline. This step utilizes the following characteristic of drainage networks: the elevation difference between adjacent manholes should be minimal. Since this rule is met in over 95% of cases, the elevations can be correctly extracted.

[0117] For pipelines that do not meet this condition, the following method is used for correction: When the difference between the pipeline starting elevation obtained by the above method and the bottom elevation of the starting manhole exceeds 0.5m, the pipeline is considered unsuitable for this method of repositioning; however, the bottom elevation of the starting manhole is taken as the pipeline starting elevation, and the pipeline endpoint elevation is taken as the data closest to the bottom elevation of the starting manhole among the endpoint elevation data. After verification using this method, nearly 99% of the data can be correctly repositioned. If it still cannot be correctly repositioned, it may be due to defects such as reverse slope in the pipeline network itself. The third and fourth steps are repeated for each manhole to obtain various elevations and numbers of each manhole, and then the fifth and sixth steps are performed to correctly parse and reposition the pipeline elevation, pipe diameter, and other data. This allows the corresponding data to be read from the block, saving the time of search and judgment, and the program can complete data extraction at a higher speed. It is expected to improve efficiency by about 50% compared to the CAD conversion process with and without leader line annotations.

[0118] Most elevations can be correctly aligned using the above method. There may be 1-3% exceptions where the elevations are not correctly aligned, requiring manual verification. This significantly reduces the workload compared to data entry without conversion of CAD data, thus improving efficiency.

[0119] Specifically, the process involves extracting data from different CAD drawings using the three methods described above, storing the data in a structured format, and then converting the structured data into shapefile data.

[0120] The first step is to use the Proj module of the pyproj program to set parameters according to the coordinate system used in the CAD drawings, and convert the X and Y coordinates of the extracted data into Web Mercator X and Y coordinates for easy display in the geographic information system.

[0121] The second step involves using the Osgeo program's algorithm to create layers, geometric features, and their attributes, then writing the data to generate a shapefile.

[0122] By utilizing CAD-GIS data conversion and standard annotation methods for drainage systems, the efficiency of inputting drawing information for manholes and pipelines can be significantly improved, for example, for an area of ​​50 km². 2 Using this method, the information entry and standardized labeling of the drainage pipe network system can be completed in just one to several weeks; the entry process takes only a few minutes, with the remaining time mainly spent verifying the accuracy of the data. The specific operation of the automatic data conversion method for municipal drainage system CAD-GIS system in this embodiment of the invention is as follows: First, the GUI-based operation process should be completed. Open the file menu, press the open option, and a dialog box for selecting a folder will appear.

[0123] This embodiment also provides a CAD-GIS data conversion and standard labeling device for drainage systems, including a CAD data analysis and extraction module, a CAD data processing module, and a shapefile data conversion module. The CAD data analysis and extraction module extracts data from CAD files according to their type and stores them as text files. The CAD data processing module generates directed graph structure data from the extracted CAD data, generates KDTree search tree structure data from the X and Y positions of text labels, filters and searches for text near preset manholes or pipeline midpoints to obtain the correct text label content, and converts elevation text into real elevations to obtain the preset manhole bottom and ground elevations and numbers, and resolves and locates the pipeline start and end point elevations and pipe diameter data. The CAD data processing module processes CAD files without leader line labels, CAD files with leader line labels, and CAD files with standard label data blocks; its processing steps have been described above and will not be repeated here.

[0124] This application embodiment also provides a computer device, which includes: a processor and a memory connected to the processor; the memory is used to store a computer program, which is at least used to perform the cleanliness detection of the construction site in this application embodiment; the processor is used to call and execute the computer program in the memory. The above-mentioned municipal drainage system CAD-GIS data conversion and standard annotation method includes at least the following steps: analyzing and extracting CAD data, extracting data from CAD according to type, and storing it as a text file; processing CAD data, generating directed graph structure data from the extracted CAD data, generating KDTree search tree structure data from the X and Y positions of the text annotations, filtering and searching for text near the midpoint of a preset inspection well or pipeline to obtain the correct text annotation content; converting elevation text into real elevation, and using this to obtain the bottom elevation and ground elevation and number of the preset inspection well, parsing and relocating the elevation and diameter data of the pipeline start and end points; and converting it into shapefile data.

[0125] This application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the program implements the steps of the above-described drainage system CAD-GIS data conversion and standard labeling method. The computer-readable storage medium may include, but is not limited to, any type of disk, including floppy disks, optical disks, DVDs, CD-ROMs, microdrives, magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic cards or optical cards, nanosystems (including molecular memory ICs), or any type of medium or device suitable for storing instructions and / or data.

[0126] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the drainage system CAD-GIS data conversion and standard annotation methods described in the above method embodiments.

[0127] Those skilled in the art will clearly understand that the technical solutions of this application can be implemented using software and / or hardware. In this specification, "unit" and "module" refer to software and / or hardware capable of independently or in conjunction with other components to perform a specific function. Hardware may include, for example, a Field-Programmable Gate Array (FPGA), an Integrated Circuit (IC), etc.

[0128] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0129] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0130] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical or other forms.

[0131] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0132] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0133] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0134] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.

[0135] The foregoing description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Other embodiments of this disclosure will be readily apparent to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described herein. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.

Claims

1. A method for converting CAD-GIS data and standardizing drainage system annotations, characterized in that, include: Analyze and extract CAD data, extract data from CAD according to type, and store it in a text file; For CAD data processing, specifically for CAD drawings of manholes without leader line annotations, the data extraction and transformation process is as follows: The first step is to use the NetworkX program's algorithm to generate directed graph structure data of the drainage network based on the selected CAD pipeline data, and to completely extract the network topology. The second step is to use the nearest neighbor search algorithm in scipy.spatial to generate KDTree search tree structure data from the X and Y positions of the text labels; The third step is to use the KDTree.query method of the search tree structure data to preset the text near the midpoint of the inspection well or pipeline; The fourth step is to use regular expressions to filter and find the correct text annotation content; The fifth step is to convert the text elevation data into real elevation data, designate the smallest data as the bottom elevation and the largest data as the top elevation, and designate the other elevation data as the preset inspection well elevation data. The sixth step is to use the KDTree.query method of the search tree structure data to extract the manholes and their numbered texts that are close to each other into two different graph data structures. Then, by referring to the concept of graph isomorphism, the manholes and their numbered texts are matched one by one, so that the numbers are automatically returned to their correct positions. Step 7: Using the elevation data determined in Step 5 and the directed graph structure data of the drainage network determined in Step 1, apply the post-order adjacency algorithm of the directed graph to obtain the endpoint manholes of the preset manholes, and obtain the elevation data of the two manholes at the start and end points. Step 8: Obtain information about the pipe diameter and material from the text near the midpoint of the pipeline; Step 9: Treat the elevation data of the starting point and the endpoint as two sets, denoted as having m and n data points respectively. Perform the Cartesian product of the sets to obtain m*n data pairs. Calculate the absolute value of the difference between the obtained data pairs, and record the elevation data pair with the smallest absolute value as the elevation of the starting point and the endpoint of the pipeline. The third to fifth steps of the inspection well circulation process are used to obtain the various elevations and numbers of each inspection well. Then, the seventh to ninth steps are used to correctly parse and relocate the pipeline elevation and diameter data. Convert to shapefile data.

2. The method for CAD-GIS data conversion and standard labeling of drainage systems according to claim 1, characterized in that, Use AutoCAD's data extraction function to extract data from CAD files according to three types: blocks, text, and lines.

3. The method for CAD-GIS data conversion and standard labeling of drainage systems according to claim 2, characterized in that, For CAD drawings of inspection wells with leader line markings, the data extraction and transformation process is as follows: The first step is to use the NetworkX program's algorithm to generate directed graph structure data of the drainage network based on the selected CAD pipeline data, and to completely extract the network topology. The second step is to use the nearest neighbor search algorithm in scipy.spatial to generate KDTree search tree structure data for the X and Y positions of the leader line and the X and Y positions of the text label, respectively. The third step is to use the KDTree.query method of the search tree structure data to find the lead-out line near the preset inspection well; The fourth step is to determine the pattern of the lead-out line, whether it is a single-baseline lead-out line or a double-baseline lead-out line, and to obtain the midpoint of each baseline. The fifth step involves using the KDTree search tree structure data to search for and extract text near the midpoint of each baseline; then filtering using regular expressions to find the correct text annotations. The sixth step is to convert the text elevation data into real elevation data, designate the smallest data as the bottom elevation and the largest data as the top elevation, and designate the other elevation data as the preset inspection well elevation data. Step 7: Assign the numbered text to the pre-set inspection well; Step 8: Using the elevation data determined in step 6 and the directed graph structure data of the drainage network determined in step 1, apply the post-order traversal algorithm of the directed graph points to obtain the endpoint manholes of the preset manholes, and obtain the elevation data of the starting and ending manholes. Step 9: Treat the elevation data of the two manholes at the start and end as two sets, denoted as having m and n data points respectively. Perform the Cartesian product of the sets to obtain m*n data pairs. Calculate the absolute value of the difference between the obtained data pairs. The elevation data pair with the smallest absolute value is the elevation of the start and end of the pipeline. The third to sixth steps of the inspection well circulation process are used to obtain the various elevations and numbers of each inspection well. Then, the eighth and ninth steps are used to correctly parse and relocate the pipeline elevation and diameter data.

4. The method for CAD-GIS data conversion and standard labeling of drainage systems according to claim 2, characterized in that, For CAD files containing standard labeled data blocks for inspection wells, the data extraction and transformation process is as follows: The first step is to use the NetworkX program's algorithm to generate directed graph structure data of the drainage network based on the selected CAD pipeline data, and to completely extract the network topology. The second step is to use the nearest neighbor search algorithm in scipy.spatial to generate KDTree search tree structure data from the X and Y positions of the leader line label block; The third step is to use the KDTree.query method of the search tree structure data to find the leader line label block near a pre-defined inspection well; The fourth step is to read the attribute data in the leader line annotation block to determine the elevation data and number data of the well top, well bottom, and pipeline connected to the inspection well. The fifth step involves using the elevation data determined in the fourth step and the directed graph structure data of the drainage network determined in the first step to apply the post-order traversal algorithm of the directed graph points to obtain the endpoint manholes of the preset manholes, thus obtaining the elevation data of the two manholes at the starting and ending points. The sixth step is to treat the elevation data of the two manholes at the starting and ending points as two sets, denoted as having m and n data points respectively. Perform the Cartesian product of the sets to obtain m*n data pairs. Calculate the absolute value of the difference between the obtained data pairs. The elevation data pair with the smallest absolute value is the elevation of the starting and ending points of the pipeline. The third and fourth steps are performed on each manhole to obtain the various elevations and numbers of each manhole. Then, the fifth and sixth steps are performed to correctly parse and assign the pipeline elevation and diameter data.

5. The method for CAD-GIS data conversion and standard labeling of drainage systems according to any one of claims 3-4, characterized in that, After extracting data from CAD and storing it in a structured format, the following steps are used to convert the structured data into shapefile data: The first step is to use the Proj module of the pyproj program to set parameters according to the coordinate system used in the CAD drawing, and convert the X and Y coordinates of the extracted data into Web Mercator X and Y coordinates for display in the geographic information system. The second step involves using the Osgeo program's algorithm to create layers, geometric features, and their attributes, then writing the data to generate a shapefile.

6. A device for converting and standardizing CAD-GIS data for drainage systems, characterized in that, The device includes: The CAD data analysis and extraction module is used to extract data from CAD files according to their type and store them in text files. The CAD data processing module is used to process CAD data for manholes without leader line annotations. Its data extraction and transformation process is as follows: Based on the selected CAD pipeline data, the NetworkX program's algorithm is used to generate directed graph structure data of the drainage network and fully extract the network topology. The nearest neighbor search algorithm in scipy.spatial is used to generate KDTree search tree structure data from the X and Y positions of the text annotations; Use the KDTree.query method to pre-define text near the midpoint of a manhole or pipeline using the search tree structure data; The correct text annotation content is found by filtering with regular expressions; the elevation text is converted into real elevation values, the smallest value in the data is designated as the bottom elevation and the largest value as the top elevation, and the other elevation data are designated as elevation data. Using the KDTree.query method of the search tree structure data, the manholes and their number texts that are close to each other are extracted into two different graph data structures. Then, by referring to the concept of graph isomorphism, the manholes and their number texts are matched one by one, so that the numbers are automatically assigned. Using the determined elevation data and the determined directed graph structure data of the drainage network, the post-order adjacency algorithm of the directed graph is applied to obtain the endpoint manholes of the preset manholes, and to obtain the elevation data of the starting and ending manholes; the elevation data of the starting and ending manholes are regarded as two sets, denoted as having m and n data points respectively, and the Cartesian product of the sets is performed to obtain m*n data pairs; the absolute value of the difference between the obtained data pairs is calculated, and the elevation data pair with the smallest absolute value is recorded as the elevation of the starting and ending points of the pipeline; the various elevations and numbers of each manhole are obtained, and the pipeline elevation and pipe diameter data are correctly parsed and assigned; and shapefile data conversion module.

7. The drainage system CAD-GIS data conversion and standard labeling device according to claim 6, characterized in that, The CAD data processing module is used to process CAD data of inspection wells with leader line annotations. Its data extraction and transformation process is as follows: Based on the selected CAD pipeline data, the NetworkX program's algorithm is used to generate directed graph structure data of the drainage network and fully extract the network topology. Using the nearest neighbor search algorithm in scipy.spatial, the X and Y positions of the leader line and the X and Y positions of the text label are used to generate KDTree search tree structure data respectively; Use the KDTree.query method of the search tree structure data to find the lead-out lines near the preset inspection well; determine the pattern of the lead-out lines, whether they are single-baseline or double-baseline lead-out lines, and obtain the midpoint of each baseline; The KDTree search tree structure data is used to search for and obtain text near the midpoint of each baseline; the correct text annotation content is found by filtering with regular expressions; the elevation text is converted into real elevations, the smallest one in the data is designated as the bottom elevation and the largest one as the top elevation, and other elevation data are designated as elevation data; at the same time, the number data is obtained. Using the elevation data determined in step six and the directed graph structure data of the drainage network determined in step one, the post-order traversal algorithm of the directed graph points is applied to obtain the endpoint manholes of the preset manholes, and to obtain the elevation data of the starting point and the endpoints. The elevation data of the starting point and the endpoint are regarded as two sets, denoted as having m and n data points respectively. The Cartesian product of the sets is performed to obtain m*n data pairs. The absolute value of the difference between the obtained data pairs is calculated. The elevation data pair with the smallest absolute value is the elevation of the two manholes at the starting point and the endpoint of the pipeline. The various elevations and numbers of each manhole are obtained, and the pipeline elevation and diameter data are correctly parsed and assigned.

8. The drainage system CAD-GIS data conversion and standard labeling device according to claim 6, characterized in that, The CAD data processing module is used to process CAD data of inspection wells with standard labeled data blocks. Its data extraction and transformation process is as follows: Based on the selected CAD pipeline data, the NetworkX program's algorithm is used to generate directed graph structure data of the drainage network and fully extract the network topology. Using the nearest neighbor search algorithm in scipy.spatial, the X and Y positions of the leader line label block are used to generate KDTree search tree structure data; Use the KDTree.query method of the search tree structure data to find the lead-out line label block near a preset inspection well; read the attribute data in the lead-out line label block to determine the elevation data and number data of the top and bottom of the well and the pipeline connected to the inspection well; Using the determined elevation data and the directed graph structure data of the drainage network, the post-order traversal algorithm of the directed graph points is applied to obtain the endpoint manholes of the preset manholes, thus obtaining the elevation data of the starting and ending manholes. The elevation data of the starting and ending manholes are regarded as two sets, denoted as having m and n data points respectively. The Cartesian product of the sets is performed to obtain m*n data pairs. The absolute value of the difference between the obtained data pairs is calculated, and the elevation data pair with the smallest absolute value is the elevation of the starting and ending points of the pipeline. The various elevations and numbers of each manhole are obtained, and the pipeline elevation and diameter data are correctly parsed and assigned.

Citation Information

Patent Citations

  • Automatic drainage network model data conversion method based on drainage network planning drawing information

    CN110298913A

  • Accurate identification method for component lead labeling text in CAD water supply and drainage professional graph

    CN112989452A