A GIS data intelligent conversion processing method and device, electronic equipment, medium and program product

By standardizing filename encoding, repairing geometric topology errors using a graphical convolutional network model, and combining a transaction-based CAD filling algorithm with LISP scripts to merge DWG files, this approach solves the problems of chaotic encoding, topology errors, and cumbersome cross-software operations in traditional GIS data conversion, achieving efficient and automated GIS data conversion processing.

CN120724975BActive Publication Date: 2025-11-04ZHUHAI HUACHENG ELECTRIC POWER DESIGN INST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511197545.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-26
Publication Date
2025-11-04
Estimated Expiration
2045-08-26

AI Technical Summary

Technical Problem

Traditional GIS data conversion methods suffer from several problems, including inconsistent file naming and encoding leading to garbled characters, geometric and topological errors resulting in incomplete conversion results, inefficient layer management, difficulty in ensuring spatial relationships when merging multiple files, cumbersome cross-software operations, and low automation.

Method used

Standardized filename encoding and a graphical convolutional network model are used to repair geometric topology errors. A transaction-based CAD filling algorithm and LISP scripts are used to merge DWG files. A custom Helper class coordinates cross-software operations to achieve automated processing.

Benefits of technology

It improves the automation level and efficiency of GIS data conversion, ensures data integrity, consistency of graphic attributes and accuracy of spatial relationships, reduces manual operation and improves the quality of conversion results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120724975B_ABST
    Figure CN120724975B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of data processing, and specifically discloses a GIS data intelligent conversion processing method and device, electronic equipment, medium and program product, which comprises the following steps: receiving an SHP format data file, processing file name coding and screening effective files; traversing the SHP file and converting it into a DWG format, and outputting according to rules; a CAD filling algorithm based on a transaction mechanism, which processes the DWG file in batches, generates a filling layer and performs entity filling; batch merging of the DWG file through a file merging algorithm, automatic adjustment of a view; and compression and packaging of the merged file for return. The application realizes full-process automatic conversion from SHP to DWG, solves the problems of coding confusion, incomplete data and complicated operation in traditional processing, and improves conversion efficiency and result accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of data processing, and particularly relates to a GIS data intelligent conversion processing method and device, electronic equipment, medium and program product. BACKGROUND

[0002] In the field of GIS data processing, conversion between SHP format and DWG format is a common requirement in engineering practice. Traditional conversion methods have many limitations: first, file naming coding is not unified, which may cause subsequent processing to be interrupted due to garbled code; second, SHP source data often has geometric topology errors such as self-intersection, line segment overlap and polygon unclosed, and traditional CAD batch processing directly reports errors or skips, resulting in incomplete conversion results; third, layer management and filling operations depend on manual work, which is low in efficiency and prone to color and attribute inconsistency; fourth, when multiple files are merged, the position and view need to be manually adjusted, which is difficult to ensure the accuracy of spatial relationships; fifth, there is a lack of cross-software collaboration mechanism, and the connection between ArcGIS and CAD operations is complicated, and the overall process automation degree is low. These problems result in long time consumption and high error rate in large-scale GIS data conversion, which is difficult to meet the requirements of efficiency and accuracy in engineering. SUMMARY

[0003] To solve the above technical problems, the application provides a GIS data intelligent conversion processing method, device, electronic equipment, medium and computer program product.

[0004] The application provides a GIS data intelligent conversion processing method, comprising the following method steps:

[0005] Step S101, receiving a SHP format data file, automatically identifying the file name and converting it to a standard coding format, filtering hidden files and irrelevant directories, and organizing valid files to a specified working directory;

[0006] Step S102, traversing SHP files in the working directory, converting the SHP files into DWG format, and automatically classifying the generated DWG files into an output directory according to a preset file name mapping rule and a coverage strategy;

[0007] Step S103, CAD filling algorithm based on transaction mechanism, loading DWG files one by one according to batch processing principle, performing image processing on the DWG files, including: traversing all layers of the DWG files, generating filling layers corresponding to original layers, automatically identifying closed curve objects of target layers and performing solid filling operation, and synchronizing color and attribute;

[0008] Step S104, batch merge the multiple image-processed DWG files into a single DWG file through a file merging algorithm, insert the DWG files as blocks and explode them into independent elements during the merging process, and automatically adjust the view range;

[0009] Step S105, automatically compress and package the merged DWG file and return it.

[0010] Another aspect of the present application also provides a GIS data intelligent conversion processing device, comprising:

[0011] The first preprocessing module is configured to receive an SHP format data file, automatically identify the file name and convert it to a standard encoding format, filter hidden files and irrelevant directories, and organize valid files to a specified working directory.

[0012] The traversal module is configured to traverse the SHP files in the working directory, convert the SHP files to DWG format, and automatically classify the generated DWG files to the output directory according to a preset file name mapping rule and a coverage strategy.

[0013] The filling module is configured to load the DWG files one by one according to a batch processing principle based on a CAD filling algorithm based on a transaction mechanism, perform image processing on the DWG files, including: traversing all layers of the DWG files, generating a filling layer corresponding to the original layer, automatically identifying a closed curve object of a target layer and performing a solid filling operation, and synchronizing the color and the attribute.

[0014] The merging module is configured to batch merge the multiple image-processed DWG files into a single DWG file through a file merging algorithm, insert the DWG files as blocks and explode them into independent elements during the merging process, and automatically adjust the view range.

[0015] The return module is configured to automatically compress and package the merged DWG file and return it.

[0016] Another aspect of the present application also provides an electronic device, comprising: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform a GIS data intelligent conversion processing method as described above.

[0017] Another aspect of the present application provides a computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions are executable by a processor to implement a GIS data intelligent conversion processing method as described above.

[0018] In another aspect of the present application, a computer program product is provided, comprising a computer program which, when executed by a processor, implements a GIS data intelligent conversion processing method as described above.

[0019] The present application solves the problems of coding confusion and invalid data interference in traditional GIS data conversion by standardizing file name coding and automatically screening valid files. The SHP file is preprocessed by a graph convolution network model to automatically detect and repair geometric topology errors, thereby avoiding result loss caused by errors and ensuring data integrity. The CAD filling algorithm based on the transaction mechanism realizes automatic filling of closed curves and synchronization of layer attributes, reduces manual operation and ensures consistency of graphic attributes. With the help of LISP scripts, DWG files are batch-merged and view range is automatically adjusted, thereby ensuring the accuracy of spatial relationships and improving the efficiency of multi-file integration. Meanwhile, the stability and ease of use are enhanced by coordinating cross-software operations through a custom Helper class, and the automation level, efficiency and result quality of SHP to DWG conversion are comprehensively improved. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0021] Other features, objects and advantages of the present application will become more apparent from the following detailed description of non-limiting embodiments, made with reference to the accompanying drawings:

[0022] Figure 1 A GIS data intelligent conversion processing method flowchart is provided for the embodiments of the present application.

[0023] Figure 2 A graph convolution network model architecture diagram is provided for the embodiments of the present application.

[0024] Figure 3 A merging algorithm workflow diagram is provided for the embodiments of the present application.

[0025] Figure 4 A structure diagram of a GIS data intelligent conversion processing device is provided for the embodiments of the present application.

[0026] Figure 5 A structure diagram of an electronic device is provided for the embodiments of the present application. DETAILED DESCRIPTION

[0027] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0028] The present application provides a GIS data intelligent conversion processing method, and the technical solutions of the present application will be described in detail below in combination with various embodiments.

[0029] As shown in the figure, Figure 1 The embodiments of the present application disclose a GIS data intelligent conversion processing method 100, comprising the following method steps:

[0030] Step S101, receiving a SHP format data file, automatically identifying the file name and converting it into a standard encoding format, filtering hidden files and irrelevant directories, and organizing the effective files to a specified working directory.

[0031] In some embodiments, the SHP format data file uploaded by the user can be received through a preset network interface, such as a file upload interface based on HTTP / HTTPS protocol, supporting single file upload or uploading of a compressed package such as ZIP format containing multiple SHP files and supporting files such as.shx,.dbf,.prj. Optionally, during the receiving process, the integrity of the file is checked, such as verifying whether the file is damaged through CRC check code, and if the check fails, an error prompt is returned to the user and the receiving process is terminated, ensuring the validity of the input data.

[0032] Then, for the received SHP file and supporting file, a file name encoding recognition mechanism is started, and through an encoding detection algorithm, such as feature analysis based on chardet library, the original encoding format of the file name is recognized, usually including ANSI, Unicode, UTF-8, GBK, etc. Subsequently, according to a preset standard encoding rule such as UTF-8 or GBK, the original encoding file name recognized is converted into a unified standard encoding format. For example, for a Chinese file name using ANSI encoding, it is converted into UTF-8 encoding, avoiding the recognition error caused by encoding incompatibility during subsequent file traversal and processing, ensuring the consistency and readability of the file name in the entire processing process.

[0033] Meanwhile, the received and decompressed file directory is scanned, and invalid data is removed according to a preset filtering rule: for hidden files, such as.thumbs.db,.DS_Store under the Windows system, or files set to be hidden through file attributes, direct deletion processing is performed; for irrelevant directories, such as user mis-uploaded document folders, log folders, temporary cache directories, etc., such directories do not contain any SHP format files and supporting files, and the entire directory is deleted after confirming that there are no valid files through detection of the file types under the directory. The filtering operation only retains valid files containing SHP format data and the directory structure where the files are located, reducing the amount of invalid data in subsequent processing links.

[0034] Finally, the filtered valid files are migrated to a specified working directory according to a preset directory structure rule. The working directory adopts a hierarchical organization method, such as constructing subdirectories according to the original upload batch and file type, storing SHP main files and their supporting files uploaded in the same batch in the same subdirectory, and maintaining the association between files, such as.shp,.shx, and.dbf files with the same name in the same directory. This organization method provides convenience for subsequent traversal of SHP files and reading of complete data, and improves file retrieval and processing efficiency.

[0035] Step S102, traversing the SHP files in the working directory, converting the SHP files into DWG format, and automatically classifying the converted DWG files into the output directory according to a preset file name mapping rule and a coverage strategy.

[0036] In some embodiments, the specified working directory and its subdirectories sorted in step S101 are recursively scanned to identify and extract all files with the.shp extension. During the traversal process, the complete path, file name (after standardization encoding in S101), and existence state of associated supporting files (such as.shx,.dbf,.prj, etc.) of each SHP file are recorded synchronously to ensure that the spatial data and attribute information of the file to be converted are complete and readable.

[0037] Next, the ExportCAD_conversion function in the ArcGIS Python interface (ArcPy) is called to perform format conversion on each SHP file obtained through traversal. Exemplarily, the output format is explicitly specified during conversion, such as DWG_R2018 version, which takes into account compatibility and functional integrity, and can be stably supported by mainstream CAD software (such as AutoCAD2018 and later versions), avoiding distortion of graphics or loss of attributes due to version differences. At the same time, two key rules are realized through function parameter configuration:

[0038] Pre-set file name mapping rule: The standardized file name of the SHP file with path relative relationship is directly mapped to the output DWG file, ensuring the consistency and traceability of the file name before and after conversion, for example, "parcel boundary.shp" is converted to "parcel boundary.dwg".

[0039] File overwrite strategy: Set the overwrite_output=True parameter, when the same name DWG file exists in the output directory, automatically overwrite the old file, avoid conversion interruption caused by file name duplication, guarantee the continuity of batch processing.

[0040] Finally, the converted DWG file is automatically migrated to the pre-set output directory and stored according to the hierarchical structure corresponding to the SHP file in the working directory. For example, "region A / road.shp" in the working directory is converted to "region A / road.dwg" in the output directory. This classification method not only maintains the original association between files, but also provides a clear file index for subsequent batch image processing, reducing path retrieval time.

[0041] In some embodiments, optionally, before converting the SHP file to DWG format, the SHP file is preprocessed, including: extracting the geometric element data in the SHP file to be converted and converting it into graph structure data, the geometric element data including point coordinates, line segment topological relationship, and polygon boundary node sequence, the graph structure data including node data, edge data, and graph structure; inputting the graph structure data into a pre-trained graph convolution network model, performing error detection on the graph structure data, and outputting error classification results; based on the error classification results, automatically correcting the SHP file based on a pre-set repair algorithm, and replacing the original file with the corrected SHP file.

[0042] It can be understood that in the SHP to DWG conversion process, part of the source data may have geometric topology errors, such as self-intersection, multi-segment overlap, and unclosed polygon, which will directly cause errors or be skipped in traditional CAD batch processing, resulting in incomplete results.

[0043] To solve this problem, in this embodiment, a deep learning-based geometric anomaly detection model, such as a graph convolution network GCN, is introduced to classify and label the element geometry in the SHP file before format conversion, and to automatically generate a repair strategy according to the error type.

[0044] Specifically, from the SHP file processed in step S101, the core data of geometric elements is extracted through a GIS data interface, such as the Describe function of ArcPy, including: point coordinates (X, Y, Z three-dimensional coordinate values of each vertex), line segment topological relationship, such as the connection, inclusion or intersection relationship between line segments, and polygon boundary node sequence (the arrangement order of the vertices constituting the polygon boundary).

[0045] The extracted geometric element data is converted into graph structure data: the vertices of the geometric elements are taken as node data, and the node attributes include coordinate values and vertex types (such as polygon endpoints and line intersection points); the connection relationship between the vertices is taken as edge data, and the edge attributes include line segment length, direction angle and connection strength (representing the closeness of the line segment association); and the association relationship between the nodes and the edges constitutes a graph structure (undirected graph), reflecting the spatial topological characteristics of the geometric elements.

[0046] Next, the converted graph structure data is input into a pre-trained graph convolutional network model, which learns the error features (such as topological error graph structure patterns such as self-intersection, overlap and unclosed) in the historical labeled data, and performs layer-by-layer feature extraction and analysis on the input data.

[0047] The model outputs error classification results, including error types such as “self-intersection error”, “multi-segment overlap” and “unclosed polygon”, error locations such as specific vertex coordinates and line segment indexes, and confidence (used to filter low-confidence misjudgment results, such as marking results with a confidence lower than 80% as to be verified).

[0048] For the error classification results output by the model, a preset repair algorithm is called to perform targeted correction; for example, for the unclosed polygon error: identify the two endpoints of the polygon (the closest non-connected vertices), generate a transition line segment through linear interpolation algorithm, complete the boundary to make the polygon closed, and ensure that the closure error is ≤ a preset value, such as 0.01 mm (satisfying the subsequent filling accuracy requirement).

[0049] For line segment overlap error: detect the repeated node sequence of the overlapping line segments, retain one as the reference line segment, and delete the completely overlapping redundant line segments; if it is a partial overlap, the overlapping area is cut off, and only the independent line segment part that is not overlapped is retained.

[0050] For self-intersection error: locate the intersection point of the self-intersecting line segment, divide the original line segment into multiple non-self-intersecting sub-line segments, and retain the reasonable sub-line segment combination in combination with the geometric context (such as the inside and outside relationship of the polygon) to eliminate the intersection conflict.

[0051] After the correction is completed, the corrected geometric element data is re-written into the SHP file to replace the original file as the input data of step S102, and a correction log is recorded, which exemplarily includes error type, coordinate change before and after correction, and correction time.

[0052] In some embodiments, as shown in FIG. 1, the graph convolution network model includes an input layer, a graph convolution layer, a global pooling layer, and a classification layer; wherein the input layer is used to receive the graph structure data extracted from the SHP file; the graph convolution layer includes a plurality of graph convolution units stacked in sequence, each of which performs adjacent node feature aggregation, nonlinear feature transformation, and batch normalization processing operations on each node respectively, and outputs node features; the global pooling layer performs global aggregation on the node features output by the graph convolution layer, generates a global feature vector through a combination of maximum pooling and average pooling; and the classification layer maps the global feature vector to a preset error category through a fully connected neural network, and outputs probability values of each category through a Softmax function to realize classification of error types. Figure 2

[0053] Specifically, for the input layer, for example, this layer serves as the data inlet of the model and is responsible for receiving the graph structure data extracted from the SHP file. The graph structure data includes node data, edge data, and graph structure relationships: the node data corresponds to the vertices of geometric elements and includes attributes such as vertex coordinates (X, Y, Z) and vertex types (such as polygon endpoints and line intersection points); the edge data corresponds to the connecting line segments between vertices and includes attributes such as line segment length, direction angle, and overlap rate; and the graph structure relationship represents the association between nodes and edges through an adjacency matrix. The input layer performs format standardization processing (for example, normalizing attribute values to the range [0, 1], which is not described in detail in this embodiment) on the received graph structure data to provide uniform format input for subsequent feature extraction.

[0054] For the graph convolution layer, for example, this layer includes 3 graph convolution units stacked in sequence, each of which processes input data according to the following flow to realize deep extraction of node features:

[0055] Adjacent node feature aggregation: for each node, all adjacent nodes are identified through an adjacency matrix, a learnable weight matrix is called to perform weighted summation on the feature vectors of the adjacent nodes, and the information of the adjacent nodes is aggregated to the current node to enhance the local correlation of the node features, such as capturing the topological relationships between line segments, such as intersection and overlap.

[0056] Nonlinear feature transformation: the ReLU activation function is applied to the aggregated node feature vector to enhance the expression ability of the model for complex topological features through nonlinear mapping, so that the feature vector is more easily distinguishable for different types of geometric errors.

[0057] ​Batch normalization: the feature vector after the activation function transformation is subjected to batch normalization operation, the mean and variance of the current batch of samples are calculated, the feature vector is standardized to the preset distribution (mean is 0, variance is 1), the influence of the difference of feature distribution between batches on model training is reduced, and overfitting is inhibited and convergence is accelerated.

[0058] After the sequential processing of the three graph convolution units, the node feature vector containing local topological details and hierarchical features is output.

[0059] For the global pooling layer, for example, the layer globally aggregates all node features output by the graph convolution layer, and exemplarily, the aggregation is realized by combining two pooling operations:

[0060] Max pooling: the maximum value of all nodes is extracted in each feature dimension, which captures the local features with significant discriminability in geometric elements, such as the intersection point of self-intersecting line segments, the end point of unclosed polygons, and the features of key positions.

[0061] Average pooling: the average value of all nodes is calculated in each feature dimension, which integrates the overall distribution features of geometric elements, such as the average length of polygon boundary, the average angle of line segment, and the features reflecting the overall topological structure.

[0062] The two pooling results are vector spliced to generate a global feature vector containing local key features and overall distribution features, which fully represents the overall topological structure of geometric elements.

[0063] For the classification layer, for example, the layer adopts a fully connected neural network structure to map the global feature vector output by the global pooling layer to a preset error class, such as self-intersection, multi-segment overlap, unclosed polygon, and no error. Exemplarily, the fully connected neural network contains 2 hidden layers (e.g., containing 128 and 64 neurons respectively), which enhances the non-linear fitting ability through ReLU activation function, and finally converts the output to probability values of each class (the probability sum is 1) through Softmax function. For example, if the probability of the "unclosed polygon" class of a geometric element is 0.92, the model determines that the element has an unclosed error, and outputs the corresponding error classification result.

[0064] In some embodiments, the training process of the GCN model exemplarily includes:

[0065] Training dataset construction: Collect SHP file samples containing geometric topology errors, covering typical error types such as self-intersecting line segments, overlapping polygon boundaries, and unclosed surface features, while including normal samples without errors; Label the geometric elements in each sample, specifying error types (labels) and error locations (such as self-intersecting coordinates, overlapping line segment indices); It should be understood that you can also choose to directly import already labeled data samples without invention or limitation.

[0066] Convert the labeled geometric elements into graph structure data (node features, edge features, graph structure), and divide them into training and validation sets in a 7:3 ratio.

[0067] Model initialization: Initialize the weight matrix and bias parameters of the graph convolution layer, set the initial mean and variance of the batch normalization layer; Define the loss function as Cross-Entropy Loss, which measures the difference between the error type probability output by the model and the true label; Choose Adam optimizer, set initial learning rate (e.g. 0.001), weight decay coefficient (e.g. 1e-5).

[0068] Iterative training: Randomly select batch samples from the training set, for example, set the batch size to 32, input the GCN model to get the error type prediction result; Calculate the loss value of the prediction result and the true label, and update the parameters (weights, biases, batch normalization parameters) of each layer of the model through the backpropagation algorithm;

[0069] Every 10 epochs, evaluate the model performance (accuracy, recall rate) using the validation set. If the validation set accuracy does not improve for 5 consecutive epochs, reduce the learning rate (multiply by 0.5);

[0070] Repeat the above steps until the model's accuracy on the validation set reaches the preset threshold (e.g. 95%) or the number of iterations reaches the upper limit (e.g. 200 epochs).

[0071] Step S103, CAD filling algorithm based on transaction mechanism, according to the principle of batch processing, load DWG file one by one, perform image processing on the DWG file, including: traversing all layers of the DWG file, generating a fill layer corresponding to the original layer, automatically identifying the closed curve object of the target layer and performing entity filling operation and synchronizing color and attribute.

[0072] In some embodiments, the DWG files generated from step S102 are extracted one by one according to the batch processing principle, the CAD application is started through the CAD automation interface (such as COM component), and the single DWG file is loaded into the memory. During the loading process, the memory resources occupied by the previously processed file are automatically released, avoiding memory overflow caused by loading multiple files at once, and ensuring the stability during large-scale file processing.

[0073] The CAD transaction is started, the layer traversal, fill layer creation and other operations are included in the transaction management, the atomicity of the operation is ensured, that is, all operations are either completely executed or rolled back in the event of an exception, to avoid damage to the graphic data.

[0074] Exemplarily, the secondary development DLL command based on C# is called, such as INDIAN_HATCHALL, all layers of the currently loaded DWG file are traversed, the attribute information of each layer is identified, including the layer name, color parameter, line type setting and the like, and the target layer is selected according to the preset filtering rule, such as the layer name containing the keywords "boundary", "plot" and the like.

[0075] For each target layer, a corresponding fill layer is automatically created, exemplarily, the naming rule is "original layer name + fill layer", for example, the original layer "plot boundary" corresponds to the fill layer "plot boundary fill layer", and the color attribute and line type attribute of the fill layer are synchronized with the original layer through the CAD secondary development interface, to ensure the visual consistency.

[0076] In the transaction environment, the entity objects are traversed in sequence according to the layers, the closed curve objects such as closed polylines and polygons are identified by analyzing the geometric attributes of the entities, such as the closure flag of the polyline and the boundary node connection relationship of the polygon.

[0077] For the identified closed curve, the Hatch object is created and the fill type is set to SOLID (solid fill), the closed curve is specified as the fill boundary, and the fill calculation is automatically completed. During the filling process, the color attribute of the Hatch object is consistent with the original layer, and after the filling is completed, it is moved to the corresponding fill layer.

[0078] Optionally, after the filling operation of a single DWG file is completed, the transaction is submitted to save all changes, and then the processed file is saved to the temporary directory. If an exception occurs during the filling process, such as forced filling of non-closed curves or operation failure caused by layer locking, the transaction is automatically rolled back, error information such as file name, error type, timestamp and the like is recorded to the log, and the next file is processed by skipping the current file, to ensure that the overall process is not interrupted.

[0079] Step S104, batch merge the multiple image-processed DWG files into a single DWG file through a file merging algorithm. During the merging process, the DWG files are inserted as blocks and exploded into independent elements, and the view range is automatically adjusted.

[0080] In some embodiments, as shown in Figure 3 The specific workflow of the merging algorithm includes:

[0081] The file merging algorithm developed based on LISP script is started, which receives the directory path of the DWG files processed in step S103 as an input parameter. By recursively traversing the directory and its subdirectories, all files with the extension.dwg are identified, a list of files to be merged is generated, and the list is sorted according to a preset rule, such as file name sorting or file modification time, to ensure the standardization of the merging order.

[0082] Next, the algorithm automatically creates a blank DWG file as a merging container, sets the drawing environment of the file such as the coordinate system and units to be consistent with the files to be merged, to avoid misalignment of graphics due to environmental differences.

[0083] According to the file list order, the DWG files to be merged are loaded one by one, and each file is inserted into the merging container as an external block (Block) through LISP script commands. During the insertion process, the insertion point of the block is automatically calculated based on the spatial coordinate information of each file to ensure that the graphic elements of different files maintain the correct spatial positional relationship in the container, such as geographical coordinate alignment.

[0084] After the block insertion is completed, the "Explode" command is immediately executed to decompose the block into independent graphic elements such as lines, filled entities, text, layers, etc., eliminating the limitations of block references on graphic editing, and allowing all elements after merging to be operated individually.

[0085] After all files are inserted and exploded, the algorithm calls the view adjustment command of CAD, such as ZOOMEXTENTS, to automatically detect the coordinate extreme values of all graphic elements in the merging container, including exemplary maximum X, minimum X, maximum Y, and minimum Y coordinates. According to the extreme values, the view range that can completely contain all graphics is calculated, and the view is adjusted to this range to ensure that the user can display all contents at once when opening the merged file without manual zooming.

[0086] Finally, after completing the view adjustment, the algorithm automatically saves the merged DWG file to the specified output directory, with the file name named according to the preset rule, such as "Merging Result_Time Stamp.dwg", and records the merging log (including the number of files involved in the merging, the time consumed for merging, whether there are exceptions, etc.), providing a basis for subsequent tracing.

[0087] Step S105, the merged DWG file is automatically compressed and packaged and returned.

[0088] In some embodiments, the merged DWG file generated in step S104 is compressed. The compression format can use the mainstream ZIP format, and the original attributes (such as creation time, modification time, file permission) and relative path structure of the file are preserved during compression to ensure the integrity and recognizability of the decompressed file.

[0089] After the compressed package is generated, it is returned to the user-specified terminal or storage location through a preset network interface (consistent with the interface for receiving the file in step S101, supporting HTTP / HTTPS protocol).

[0090] In some embodiments, a custom Helper class is built using Python language to encapsulate the underlying operation interface of CAD and ArcGIS, and to realize the automatic scheduling of the entire SHP→DWG conversion process.

[0091] Specifically, the Helper class includes an ArcGIS operation module and a CAD operation module, which encapsulate the corresponding function interfaces. For example, the ArcGIS module includes SHP file reading (calling the ListFeatureClasses function of ArcPy), format conversion (calling the ExportCAD_conversion function), and other methods; the CAD module includes application startup (creating a CAD instance through win32com.client), command execution (sending a LISP command string to the CAD interface), and file saving methods, and each module shares configuration parameters (such as output directory path, version number) through class member variables.

[0092] Illustratively, the Helper class coordinates the operation timing of ArcGIS and CAD through an event triggering mechanism. For example, when the ArcGIS module completes the SHP→DWG format conversion, it triggers a "conversion complete" event, and the CAD module listens to the event and automatically starts the CAD application to begin performing the graphic filling operation. This mechanism avoids hard-coded timing dependencies and ensures smooth operation between different software.

[0093] Illustratively, the Helper class provides a top-level process control method, such as run_pipeline, which sequentially calls data preprocessing, format conversion, graphic filling, file merging, and other sub-methods, and reads the parameters of each step from a configuration file, such as DWG version, filling color mapping rules. For example, in the format conversion step, the method gets the "whether to overwrite existing files" parameter from the configuration file and automatically sets the overwrite_output attribute of the ArcPy function, without manual intervention.

[0094] Figure 4 A GIS data intelligent conversion processing device 400 is shown. The device embodiment corresponds to the method embodiment shown, and the device can be specifically applied to various electronic devices. Specifically, it includes: Figure 1

[0095] A first preprocessing module 401 is configured to receive an SHP format data file, automatically identify the file name and convert it to a standard encoding format, filter hidden files and irrelevant directories, and organize valid files to a specified working directory.

[0096] A traversal module 402 is configured to traverse the SHP files in the working directory, convert the SHP files to DWG format, and automatically classify the generated DWG files to the output directory according to the preset file name mapping rule and the coverage strategy.

[0097] A filling module 403 is configured to load the DWG files one by one according to the CAD filling algorithm based on the transaction mechanism and the batch processing principle, perform image processing on the DWG files, including: traversing all layers of the DWG files, generating a filling layer corresponding to the original layer, automatically identifying the closed curve object of the target layer and performing the solid filling operation, and synchronizing the color and attribute.

[0098] A merging module 404 is configured to merge multiple image-processed DWG files into a single DWG file by using a file merging algorithm, insert the DWG file as a block and explode it into independent elements during the merging process, and automatically adjust the view range.

[0099] A back transmission module 405 is configured to automatically compress and package the merged DWG file and transmit it back.

[0100] Based on the same inventive concept, the electronic device provided in the embodiments of the present application can correspond to the method in the foregoing embodiments, and the problem solving principle thereof is similar to that of the method. The electronic device provided in the embodiments of the present application includes at least one processor, and a memory in communication connection with the at least one processor. The memory stores instructions executable by the at least one processor. The instructions are executed by the at least one processor, so that the at least one processor can execute the method and / or technical solution of the foregoing embodiments of the present application.

[0101] ​The electronic device can be a user device, or a device integrated by a user device and a network device through a network, or can also be an application program running on the above device, the user device includes but is not limited to computers, mobile phones, tablets, smart watches, bracelets and various terminal devices, and the network device includes but is not limited to network hosts, single network servers, multiple network server sets or computer sets based on cloud computing, which can be used to realize part of the processing function when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, wherein the cloud computing is a kind of distributed computing, which is a virtual computer composed of a group of loosely coupled computer sets.

[0102] Figure 5 The structure of a device suitable for implementing the method and / or technical scheme in the embodiments of the present application is shown, the device 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 502 or programs loaded from a storage part 508 to a random access memory (RAM) 503. In the RAM 503, various programs and data required for system operation are also stored. The CPU 501, the ROM 502 and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0103] The following components are connected to the I / O interface 505: an input part 506 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, etc.; an output part 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), an LED display, an OLED display, etc., and a speaker, etc.; a storage part 508 including one or more computer readable media such as a hard disk, an optical disk, a magnetic disk, a semiconductor memory, etc.; and a communication part 509 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication part 509 performs communication processing via a network such as the Internet.

[0104] In particular, the method and / or embodiment in the embodiments of the present application can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program comprising program codes for executing the method shown in the flow chart. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the method of the present application are executed.

[0105] Another embodiment of the present application also provides a computer readable storage medium having computer program instructions stored thereon, which can be executed by a processor to implement the method and / or technical scheme of any one or more embodiments of the foregoing present application.

[0106] In particular embodiments, any combination of one or more computer readable medium can be utilized. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium can be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.

[0107] A computer readable signal medium can include a propagated data signal with computer readable program code embodied therein, for use by or in connection with an instruction execution system, apparatus, or device. The computer readable program code can be transmitted using any appropriate medium, including but not limited to wireless, wire line, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0108] Computer readable program code can be implemented in any of various ways. For example, it can be implemented using a high level procedural or object oriented programming language to implement inventive functionality. Alternatively it can be implemented using a rules- based system (such as a rule based system as utilized in artificial intelligence

[0109] The flow diagrams and block diagrams in the drawings are representative of the architecture, functionality, and operation of possible implementations of devices, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flow diagrams or block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical functions ("instruction(s)"). It should also be noted that in some alternative implementations, the functions noted in the block can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks can sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flowchart illustrations, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

[0110] Furthermore, the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. Multiple units or devices referred to in apparatus claims can also be implemented as software or hardware by means of one unit or device. The terms first, second, etc. do not denote any order. They are used to distinguish between different, consecutive elements, steps or units.

Claims

1. A GIS data intelligent conversion processing method, characterized in that, The method comprises the following steps: Step S101, receiving an SHP format data file, automatically identifying the file name and converting it into a standard encoding format, filtering hidden files and irrelevant directories, and organizing valid files into a specified working directory; Step S102, traversing SHP files in the working directory, converting the SHP files into DWG format, and automatically classifying the converted DWG files into an output directory according to a preset file name mapping rule and an overlay strategy; Step S103, based on a CAD filling algorithm of a transaction mechanism, loading DWG files one by one according to a batch processing principle, performing image processing on the DWG files, including: traversing all layers of the DWG files, generating filling layers corresponding to the original layers, automatically identifying closed curve objects of target layers and performing solid filling operations, and synchronizing colors and attributes; Step S104, batch merging multiple image-processed DWG files into a single DWG file through a file merging algorithm, inserting the DWG files as blocks and exploding them into independent elements during the merging process, and automatically adjusting the view range; Step S105, automatically compressing and packaging the merged DWG file and returning it; Before converting the SHP file into DWG format, the method further comprises preprocessing the SHP file, including: extracting geometric feature data in the SHP file to be converted into graph structure data, the geometric feature data including point coordinates, line segment topological relations, and polygon boundary node sequences, and the graph structure data including node data, edge data, and graph structure; inputting the graph structure data into a pre-trained graph convolutional network model, performing error detection on the graph structure data, and outputting error classification results; based on the error classification results, automatically correcting the SHP file based on a preset repair algorithm, and replacing the corrected SHP file with the original file.

2. The GIS data intelligent conversion processing method according to claim 1, wherein: the graph convolutional network model comprises an input layer, a graph convolutional layer, a global pooling layer, and a classification layer; the input layer is used to receive the graph structure data extracted from the SHP file; the graph convolutional layer comprises a plurality of graph convolutional units stacked in sequence, each of which performs adjacent node feature aggregation, nonlinear feature transformation, and batch normalization processing operations on each node to output node features; the global pooling layer globally aggregates the node features output by the graph convolutional layer to generate a global feature vector through a combination of maximum pooling and average pooling; the classification layer maps the global feature vector to a preset error category through a fully connected neural network and outputs probability values of each category through a Softmax function to realize error type classification.

3. The GIS data intelligent conversion processing method according to claim 1, wherein: the traversing of all layers of the DWG file, the generation of filling layers corresponding to the original layers, the automatic identification of closed curve objects of target layers, and the performance of solid filling operations, and the synchronization of colors and attributes are specifically: The secondary development DLL command is called to traverse all layers in the currently loaded DWG file, automatically identify the attribute information of each layer, and filter out target layers based on preset filtering rules; Based on each filtered target layer, a corresponding fill layer is automatically created, and the color attribute and line type attribute of the fill layer are synchronized with the original layer based on the secondary development interface; The entity objects are traversed in order according to layers, the closed curves are identified by analyzing the geometric attributes of the entity objects, and the fill layer is filled with entities based on the Hatch object and the closed curves as the fill boundary.

4. The GIS data intelligent conversion processing method according to claim 1, characterized in that the file merging algorithm automatically merges batch DWG files through a LISP script, specifically comprising: Step S301, starting the LISP script to receive a directory path parameter of DWG files to be merged, generating a file list by recursively traversing all DWG files in the directory; Step S302, creating a blank DWG file as a merging container, loading each file to be merged in order according to the file list and inserting it as an external block into the container file, and after the block insertion is completed, executing a blast command to decompose the block into independent graphic entities; Step S303, calling the view adjustment command of CAD to automatically calculate the coordinate extreme values of all entity objects and adjust the view range to an area that can completely contain all graphics.

5. The GIS data intelligent conversion processing method according to claim 1, characterized in that it further comprises constructing a custom Helper class to realize integration, specifically comprising: The Helper class adopts modular design and includes an ArcGIS operation module and a CAD operation module, which respectively encapsulate corresponding function interfaces, and each module shares configuration parameters through class member variables; the operation timing of ArcGIS and CAD is coordinated through an event triggering mechanism, corresponding events are triggered after the ArcGIS module completes operation, the CAD module listens to the events and then performs corresponding operation; a top-level flow control method is provided to sequentially call the sub-methods of each processing step and read the parameters of each step through a configuration file. including: A first preprocessing module for receiving SHP format data files, automatically identifying file names and converting them to standard encoding format, filtering hidden files and irrelevant directories, and organizing valid files to a specified working directory; 6. A GIS data intelligent conversion processing apparatus, characterized by comprising: A traversal module for traversing SHP files in the working directory, converting the SHP files to DWG format, and automatically classifying the generated DWG files to the output directory according to preset file name mapping rules and coverage strategies; A fill module for a CAD filling algorithm based on a transaction mechanism, which loads DWG files one by one according to batch processing principles, performs image processing on the DWG files, including: traversing all layers of the DWG file, generating fill layers corresponding to the original layers, automatically identifying closed curve objects of target layers and performing entity filling operations, and synchronizing colors and attributes; ​ ​ The merging module is used for merging the plurality of image-processed DWG files into a single DWG file in batches through a file merging algorithm, inserting the DWG files as blocks and exploding them into independent elements during the merging process, and automatically adjusting the view range; The back transmission module is used for automatically compressing and packaging the merged DWG file and transmitting it back; Before the SHP file is converted into the DWG format, the SHP file is preprocessed, including: extracting geometric element data in the SHP file to be converted into graph structure data, the geometric element data including point coordinates, line segment topological relations and polygon boundary node sequences, and the graph structure data including node data, edge data and graph structure; inputting the graph structure data into a pre-trained graph convolution network model, performing error detection on the graph structure data, and outputting error classification results; based on the error classification results, automatically correcting the SHP file based on a preset repair algorithm, and replacing the original file with the corrected SHP file.

7. An electronic device, the electronic device comprising: comprise: at least one processor; and a memory connected in communication with the processor; wherein the memory stores instructions executable by the processor, and the instructions are executed by the processor to enable the processor to perform the method of any one of claims 1-5.

8. A computer readable medium having stored thereon computer program instructions, characterized in that, The computer program instructions can be executed by the processor to implement the method of any one of claims 1-5.

9. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1-5.

Citation Information

Patent Citations

  • Method and device for automatically generating geographic space data based on DWG file

    CN115757669A

  • Method and system for lossless conversion between CAD geographic data and SHP data

    CN118332037A