Arcpy-based railway track plane graph automatic generation method
Automated generation of railway track floor plans through Arcpy technology, solving the problems of low manual drawing efficiency and high deep learning cost, and achieving efficient and accurate railway track floor plans, reducing costs and improving the standardization and reliability of the layers.
Patent Information
- Application Number
- CN202410937871.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-12-03
AI Technical Summary
The existing railway track plan map generation method relies on manual drawing, which is inefficient, high cost and easy to generate errors. Although deep learning methods bring potential for automated processing, they require massive annotation of data, expensive computing resources, and opaque decision-making process, which is difficult to be critical to safety. Domain application.
Using Arcpy-based automatic drawing technology, we automatically rotate the railway track image layer, create a Mysql-related database, query and draw standardized curve elements, reduce manual dependence, and improve efficiency and accuracy.
It significantly reduces the drawing time and cost, improves the standardization and accuracy of the layers, reduces errors caused by human factors, and improves the generation efficiency and quality of railway track plan.
Smart Images

Figure CN119068078A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automated data processing and railway transportation management, and in particular to an Arcpy-based method for automatically generating a railway track plan. Background Art
[0002] The railway electronic map is a digital railway map containing longitude and latitude information. It provides great convenience and safety for train drivers, railway managers and other practitioners in the railway industry. It accurately displays the longitude and latitude positioning information on the railway track, allowing railway industry practitioners to obtain equipment and train status information data on the railway track more quickly. It provides more convenience for the application of the railway industry and greatly enhances the safety and stability of train operation.
[0003] Railway track map is an important part of railway electronic map, which can present railway track information and positioning information in a clearer form for train drivers and railway management personnel. At present, its generation method mainly relies on manual drawing, which usually takes 3 to 5 days to draw a map, with high labor cost and low efficiency. In addition, errors are prone to occur during the drawing process due to the subjective experience of the drawing staff and the lack of unified standards. There is an urgent need for automated and digital solutions to improve the accuracy, efficiency and standardization of maps and reduce costs.
[0004] Other methods have obvious shortcomings: the use of deep learning methods in the standardization and automation of railway track map processing projects is not as lightweight as the present invention. Although it can bring data-driven decision optimization and intelligent operation potential, it is also accompanied by significant challenges. The primary difficulty lies in the huge data demand. The training of deep learning models often requires massive, high-quality labeled data, and the acquisition and organization of railway track data may be costly and time-consuming. Secondly, the computing resource requirements for model training are extremely demanding, and high-end GPU acceleration is often required, which undoubtedly increases the cost and technical threshold of the project. In addition, the "black box" characteristics of deep learning make the decision-making process of the model difficult to be intuitively analyzed, reducing the feasibility of application in safety-critical areas. In addition, the generalization ability of the model is limited by the diversity of training data, and may perform poorly in the face of new environments. Therefore, although deep learning has brought innovative possibilities to the processing of railway track maps, the many obstacles faced in its implementation process cannot be ignored, and its applicability and potential risks need to be carefully evaluated. Summary of the invention
[0005] The present invention uses automatic drawing technology to replace manual drawing, which not only improves the efficiency of converting the original railway track image map into the railway track plan map, but also ensures the consistency and accuracy of the drawing through a unified drawing standard. In addition, this method also helps to save drawing costs because it reduces the dependence on professional draftsmen, reduces labor costs, and improves overall work efficiency and quality.
[0006] The automatic generation method of railway track plan based on Arcpy is realized by the following steps:
[0007] Step 1: Use ArcPy to automatically rotate all the elements in the original railway track image layer to a horizontal state;
[0008] Step 2: Use Arcpy to obtain the point features, curve features and their related attribute data in the original railway track image layer in ArcGIS and create a MySQL relational database RailwayTrackingDB;
[0009] Step 3: query the RailwayTrackingDB database in step 2, obtain the undrawn and transformed curve elements with the most intersections and their related intersection data, and draw them to enrich and expand the standardized railway track plane layer;
[0010] Step 4: query the RailwayTrackingDB database in step 2, obtain the curve element PolyLine that only intersects with the drawn curve in the standardized railway track plane layer or does not intersect at all, and draw the converted polyline element based on the drawn standardized railway track plane layer;
[0011] Step 5: query and integrate the curve elements in the RailwayTrackingDB database in step 2 that intersect with the drawn curves in the standardized railway track plane layer and also intersect with the curve elements that have not been drawn and converted, draw and convert them into PolyLine, thereby enriching and expanding the existing standardized railway track plane layer, and then execute step 3 until all the curve elements recorded in step 1 are drawn;
[0012] Step 6. After drawing all curve elements, adjust the interval between the broken lines.
[0013] Beneficial effects of the present invention: Compared with the traditional manual drawing method, the present invention uses machines to replace manual work, significantly reducing costs, and reducing the drawing time from the original 3 to 5 days to 30 to 50 minutes per picture, greatly improving the drawing efficiency. The consistency of drawing standards ensures a high degree of accuracy and uniformity, greatly reducing errors and differences caused by human factors, thereby improving efficiency while ensuring the quality and reliability of the results.
[0014] (1) Combining Geographic Information System (GIS) with database technology provides a comprehensive solution for processing and analyzing railway trajectory data.
[0015] (2) Spatial data analysis and processing were performed through the ArcPy library and related tools, which optimized the quality of the railway trajectory map and improved the availability of the data. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a schematic diagram of the process of the present invention;
[0017] Figure 2 It is a schematic diagram of the horizontalization of elements in the original railway track image layer in the present invention;
[0018] Figure 3 It is a schematic diagram of the process of converting a local original railway track image into a railway track plane map according to the present invention, and the input end of the railway track is shown here;
[0019] Figure 4 This is a sample diagram of the final standardized result of the present invention; DETAILED DESCRIPTION
[0020] Combination Figures 1 to 3 This embodiment ( Figure 3 The method for automatically generating a railway track plan based on Arcpy is implemented by the following steps:
[0021] The method for automatically generating a railway track plan based on Arcpy includes the following steps:
[0022] Step 1: Automatically rotate all elements in the original railway track image layer to a roughly horizontal state, specifically:
[0023] Step 1.1: For polynomial fitting, use is the objective function, and the least square method is used to find the minimum objective S of the parameterized curve;
[0024] Step 1.2: Derivative the fitted curve function p(x) to obtain the slope function p ′ (x);
[0025] Step 1.3, the average slope is obtained by removing 10% of the extreme values from the slopes obtained from all the curves;
[0026] Step 1.4. Finally, select all layer features through the rotate() function in the ArcPy library to obtain the horizontal result.
[0027] Step 2, obtaining and storing the point element curve element and the interrelated attribute data of the original railway track image layer;
[0028] Step 2.1, create a search cursor to traverse the curve elements and extract basic information such as length;
[0029] Step 2.2, use the Intersect tool to analyze the curve feature class and generate intersection features;
[0030] Step 2.3, use the ArcPy search cursor SearchCursor to traverse the new feature output and extract the geometric information of each feature;
[0031] Step 2.4: Create a relational database RailwayTrackingDB that stores points and lines, as well as the interaction between lines (starting and ending points) and reflects the front-end relationship of intersection points and the distance length relationship.
[0032] Step 3, select the curve that is not currently drawn and has the most intersections from the RailwayTrackingDB database in step 2 and transform and draw it;
[0033] Step 3.1, query the RailwayTrackingDB database in step 2.4 for the curve feature information that is not drawn (the curve feature information FLAG is false) and has the most intersections (the curve feature contains the most intersection points) and its intersection details such as the interaction point belonging element, sorting, length, etc.;
[0034] Step 3.2, if the standardized railway track plane layer is empty, determine the length of the straight line after converting the standard map by the number of point elements it has, and draw a straight line horizontally from its starting point as the standard reference of the railway track;
[0035] Step 3.3, if the standardized railway track plane layer is not empty, obtain the x-coordinate of the initial point of the curve from the RailwayTrackingDB database and compare it with the x-coordinate of the intersection point to determine the direction of adding the turning point, which is divided into two cases: rotating 45° clockwise at the intersection point and rotating 135° clockwise;
[0036] Step 3.4: Calculate the distance of the point element in this direction (if it is greater than 100, it is considered that no polyline has been drawn in this direction). If there is a polyline, determine the polyline with 1 / 2 of this distance.
[0037] Step 3.5, if it does not exist, draw a straight line 40 units along the y-axis direction to determine the inflection point;
[0038] Step 3.6: Use the InsertCursor tool in ArcPy to insert the standardized railway track plane layer using the vertex data.
[0039] Step 4, enrich and expand the existing standardized railway track plane layer by selecting the curve elements that can be uniquely determined by the curves in the existing standardized railway track plane layer in the database of step 2;
[0040] Step 4.1, query the RailwayTrackingDB database in step 2 for the curve elements and intersection elements that have not been drawn and whose intersection curves have been drawn in the standardized railway track plane layer, and the curve elements and intersection element information that can be uniquely determined;
[0041] Step 4.2: Similarly, add a new polyline using the polyline drawing method in step 3 above and insert it into the standardized railway track plane layer;
[0042] Step 5: The curve elements in the original railway track image layer cannot be uniquely identified in the existing standardized railway track plane layer, and a new conversion polyline corresponding to not only the curve elements intersecting with the existing standardized railway track plane layer is required.
[0043] Step 5.1: If there is no curve element in the RailwayTrackingDB database of step 2 that can be uniquely identified by the existing standardized railway track plane layer, go to step 3;
[0044] Step 5.2: If all curve elements in the RailwayTrackingDB database in step 2 have been converted, it means that the standardized railway track plane layer is roughly filled.
[0045] Step 6: Standardize and adjust the polyline spacing of the standardized railway track plane layer;
[0046] Step 6.1, define the Offset_distance y-axis deviation distance (40 units), define the input feature class and output feature class and the offset direction (polyline extension direction);
[0047] Step 6.2: Use the arcpy.PolylineOffset_management method to offset the line features in the standard transformation map from top to bottom, with an offset parameter of 40.
[0048] Combination Figures 1 to 4 To explain this embodiment, Figure 1 is the algorithm flow chart, Figure 2 This is an illustration of a real local transformation. Figure 3 This is the final transformation standard trajectory map result. Figure 4 The figure is a schematic diagram of the horizontalization of the original railway track image layer. It can be seen that the automatic generation method of the railway track plan based on Arcpy is more lightweight and realizes the generation of the railway track plan in an efficient and standard manner.
Claims
1. A method for automatically generating a railway track plan based on Arcpy, characterized in that: The method is implemented by the following steps: Step 1: Use Arcpy to automatically rotate all the elements in the original railway track image layer to a horizontal state; Step 2: Use Arcpy to extract point and line features and their attribute information from the original railway track image layer, and then organize and store these data in the RailwayTrackingDB database of MySQL to achieve effective management and analysis of complex railway track data; Step 3: query the RailwayTrackingDB database in step 2, obtain the undrawn and transformed PolyLine with the most intersecting curve elements and their related intersection data, and draw them to enrich and expand the standardized railway track plane layer; Step 4: query the RailwayTrackingDB database in step 2, and obtain the PolyLine elements of the curves that only intersect with the drawn curves in the standardized railway track plane layer or do not intersect at all, and then draw the polyline elements based on the standardized railway track plane layer; Step 5: query and integrate the curve elements in the RailwayTrackingDB database in step 2 that intersect with the drawn curves in the standardized railway track plane layer and also intersect with the curve elements that have not been drawn and converted, so as to enrich and expand the existing standardized railway track plane layer, and then execute step 3 until all the curve elements recorded in step 1 are drawn; Step 6. After drawing all curve elements, adjust the interval between the broken lines.
2. The method for automatically generating a railway track plan based on Arcpy according to claim 1, characterized in that: The specific process of step one is: Step 1: For the polynomial fitting problem, the objective function is defined as , Use the least squares method to find the minimum target S of the parameterized curve, and then take the derivative of the fitted curve function p(x) to get the slope function p ′ (x); Step 1 and 2: Remove the slope function p ′ (x) The average of the remaining slope values is calculated for the 10% maximum and minimum points on its domain (i.e., removing outliers), which represents the "average slope" of the curve. Using this average slope, the rotation function in the GIS software (such as the arcpy.Rotation_management() function in ArcGIS) is used to rotate the original railway track image layer so that the overall layer is closer to the horizontal.
3. The method for automatically generating a railway track plan based on Arcpy according to claim 1, characterized in that: In step 2, ArcPy is used to accurately process the track curve feature data in the original railway track image layer in ArcGIS, and combined with MySQL to create an efficient and scalable relational database system to achieve automatic data extraction, in-depth attribute analysis, dynamic association query and continuous performance optimization; In GIS software, use the Intersect tool (or similar functions, such as "Intersection Analysis") to automatically perform intersection analysis. This tool detects and identifies the intersections between different PolyLine features, that is, the intersection points. It compares the spatial positions of each line feature and finds the overlapping or intersecting locations.
4. The method for automatically generating a railway track plan based on Arcpy according to claim 1, characterized in that: The specific process of step three is: Step 3:
1. For drawing the most intersecting and undrawn curve elements PolyLine, thereby enriching and extending the drawing method of the standardized railway track plane layer, query the Points point element information, PolyLine curve element information and possible intersection data between lines related to the intersection of the curve elements in the existing standardized railway track plane layer from the RailwayTrackingDB extracted in step 2; Step 32: If the standardized railway track plane layer is empty, the number of point elements contained in the extracted curve elements in the data is obtained by querying in step 31, and the straight line elements are drawn based on this as the length data standard to establish the basis of the standardized railway track plane layer; Step 33. If the standardized railway track plane layer is not empty, extract the x-coordinate of the initial point element of the curve in the original trajectory diagram from the data obtained through the query in step 31, so as to determine its corresponding starting and ending positions in the standardized railway track plane layer, and then determine the direction of adding the inflection point, and extend this direction to 1 / 2 the length of the distance to the point element, and draw the inflection point, and draw the broken line with the inflection point.
5. The method for automatically generating a railway track plan based on Arcpy according to claim 1, characterized in that: The specific process of step 4 is as follows: Step 41: During the traversal drawing process, if there is a curve element that only intersects with the curve element PolyLine in the drawn standardized railway track plane layer or has no intersection point, draw the intersection point based on the standardized railway track plane layer by inserting the cursor InsertCursor; Step 42: Determine the start and end segments and determine whether to rotate 45° or 135° clockwise to draw the polyline points. Use the above point elements as the data basis (pts) to introduce the polyline through the Arcpy.PolyLine(pts) library function.
6. The method for automatically generating a railway track plan based on Arcpy according to claim 1, characterized in that: The specific process of step five is: Step 51: query the RailwayTrackingDB extracted in step 2 to obtain curve elements that intersect with the drawn curves in the standardized railway track plane layer and also intersect with the curve elements that have not been drawn yet; Step 52: Carry the query elements of step 51 and go back to step 33 to continue execution.
7. The method for automatically generating a railway track plan based on Arcpy according to claim 1, characterized in that: The specific features of step six are: Step 61: After all curve elements are drawn, adjust the interval between the broken lines. The standard interval of the average broken line in the y direction is 40 units. Step 6.2: Use arcpy.PolylineOffset_managementArcpy offset tool to create parallel copies of the first feature and adjust them to the standard interval.
