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

By standardizing file name encoding and repairing geometric topology errors with a graphics convolutional network model, and combining the transaction mechanism's CAD filling algorithm with LISP scripts to merge DWG files, the problems of confusing encoding, topological errors, and cumbersome cross-software operations in GIS data conversion are solved, achieving an efficient and automated data conversion process.

CN120724975AActive Publication Date: 2025-09-30ZHUHAI HUACHENG ELECTRIC POWER DESIGN INST CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

Existing GIS data conversion methods have problems such as inconsistent file naming and encoding leading to garbled characters, geometric topology errors leading to incomplete conversion results, inefficient layer management, difficulty in ensuring spatial relationships when merging multiple files, cumbersome cross-software operations, and low overall process automation.

Method used

Standardized file name encoding and graphics convolutional network models are used to repair geometric topology errors. CAD filling algorithms based on transaction mechanisms and LISP scripts are used to merge DWG files. Custom Helper classes are used to coordinate cross-software operations and achieve automated processing.

Benefits of technology

It improves the automation level and efficiency of GIS data conversion, ensures data integrity and graphic attribute consistency, and improves the accuracy and stability of multi-file merging.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120724975A_ABST
    Figure CN120724975A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of data processing, and particularly discloses a GIS data intelligent conversion processing method and device, electronic equipment, a medium and a program product, and the method comprises the steps: receiving an SHP format data file, processing a file name code, and screening effective files; traversing the SHP file, converting the SHP file into a DWG format, and classifying and outputting the SHP file according to rules; processing the DWG file in batches based on a CAD filling algorithm of a transaction mechanism, generating a filling layer and executing entity filling; the DWG files are merged in batches through a file merging algorithm, and views are automatically adjusted; and compressing, packaging and returning the combined file. According to the method, the full-process automatic conversion from the SHP to the DWG is realized, the problems of coding disorder, incomplete data, complicated operation and the like in the traditional processing are solved, and the conversion efficiency and the result accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of data processing technology, and specifically relates to a GIS data intelligent conversion and processing method, device, electronic equipment, medium and program product. Background Art

[0002] In the field of GIS data processing, conversion between SHP and DWG formats is a common requirement in engineering practice. Traditional conversion methods have many limitations: First, file naming and encoding are not uniform, which can easily lead to garbled characters and interrupt subsequent processing; second, SHP source data often contains geometric topological errors such as self-intersections, overlapping line segments, and unclosed polygons. Traditional CAD batch processing directly reports errors or skips, resulting in incomplete conversion results; third, layer management and fill operations rely on manual labor, which is inefficient and prone to color and attribute inconsistencies; fourth, when merging multiple files, the position and view must be manually adjusted, making it difficult to ensure the accuracy of spatial relationships; fifth, there is a lack of cross-software collaboration mechanisms, the connection between ArcGIS and CAD operations is cumbersome, and the overall process automation level is low. These problems result in large-scale GIS data conversion being time-consuming and error-prone, making it difficult to meet the efficiency and accuracy requirements of engineering projects. Summary of the Invention

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

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

[0005] Step S101: Receive SHP format data files, automatically identify file names and convert them into standard encoding formats, filter hidden files and irrelevant directories, and organize valid files into a designated working directory;

[0006] 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 an output directory according to a preset file name mapping rule and overwriting strategy;

[0007] Step S103: A CAD fill algorithm based on a transaction mechanism loads DWG files one by one in batch processing and 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 in the target layer, performing entity fill operations, and synchronizing colors and attributes;

[0008] Step S104, batch merging the plurality of DWG files that have undergone image processing into a single DWG file using a file merging algorithm, inserting the DWG file as a block and exploding it into independent elements during the merging process, and automatically adjusting the view range;

[0009] Step S105: Automatically compress and package the merged DWG file and transmit it back.

[0010] In another aspect, the present application further provides a GIS data intelligent conversion and processing device, comprising:

[0011] The first pre-processing module is used to receive SHP format data files, automatically identify the file name and convert it into a standard encoding format, filter hidden files and irrelevant directories, and organize valid files into a specified working directory;

[0012] A traversal module is used to traverse the SHP files in the working directory, convert the SHP files into DWG format, and automatically classify the converted DWG files into an output directory according to a preset file name mapping rule and overwriting strategy;

[0013] A fill module is used for a transaction-based CAD fill algorithm, loading DWG files one by one in batch processing, and performing 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 in the target layer, performing entity fill operations, and synchronizing colors and attributes;

[0014] a merging module, configured to batch merge the plurality of DWG files that have undergone image processing into a single DWG file using a file merging algorithm, inserting the DWG file as a block and exploding it into independent elements during the merging process, and automatically adjusting the view range;

[0015] The return module is used to automatically compress and package the merged DWG files and return them.

[0016] On the other hand, the present application also provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed 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 execute the GIS data intelligent conversion and processing method as described above.

[0017] In another aspect of the present application, a computer-readable storage medium is provided, on which computer program instructions are stored. The computer program instructions can be executed by a processor to implement the above-mentioned method for intelligent conversion and processing of GIS data.

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

[0019] The present invention solves the problems of confusing encoding and invalid data interference in traditional GIS data conversion by standardizing file name encoding and automatically screening valid files; preprocessing SHP files through a graphic convolutional network model automatically detects and repairs geometric topological errors, avoiding result loss due to 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, reducing manual operations and ensuring consistency of graphic attributes; batch merging DWG files and automatically adjusting the view range with the help of LISP scripts ensures the accuracy of graphic spatial relationships and improves the efficiency of multi-file integration; at the same time, through the customized Helper class to coordinate cross-software operations, it enhances stability and ease of use, and comprehensively improves the automation level, efficiency and result quality of SHP to DWG conversion. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.

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

[0022] Figure 1 A flowchart of a GIS data intelligent conversion and processing method provided by an embodiment of the present invention.

[0023] Figure 2 Schematic diagram of the graph convolutional network model architecture provided by an embodiment of the present invention.

[0024] Figure 3 A schematic diagram of the merging algorithm workflow provided by an embodiment of the present invention.

[0025] Figure 4 It is a structural diagram of a GIS data intelligent conversion and processing device provided by an embodiment of the present invention.

[0026] Figure 5 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0027] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0028] This application proposes a method for intelligent conversion and processing of GIS data. The technical solution of this application is described in detail below in conjunction with various embodiments.

[0029] like Figure 1 As shown, the embodiment of the present invention discloses a GIS data intelligent conversion processing method 100, which includes the following method steps:

[0030] Step S101, receiving a data file in SHP format, 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 designated working directory.

[0031] In some embodiments, SHP-formatted data files uploaded by users can be received via a preset network interface, such as a file upload interface based on the HTTP / HTTPS protocol. This supports uploading a single file or a compressed package containing multiple SHP files and supporting files such as .shx, .dbf, and .prj files, such as in ZIP format. Optionally, during the receiving process, the file is checked for integrity, such as by using a CRC checksum to verify file corruption. If the check fails, an error message is returned to the user and the reception is terminated, thereby ensuring the validity of the input data.

[0032] Next, for the received SHP files and supporting files, the file name encoding recognition mechanism is activated. Through the encoding detection algorithm, such as feature analysis based on the chardet library, the original encoding format of the file name is identified, which usually includes ANSI, Unicode, UTF-8, GBK, etc. Subsequently, according to the preset standard encoding rules such as UTF-8 or GBK, the identified original encoding file name is converted into a unified standard encoding format. For example, for Chinese file names encoded in ANSI, they are converted into UTF-8 encoding to avoid garbled file names due to encoding incompatibility or recognition errors during subsequent file traversal and processing, thereby ensuring the consistency and readability of the file name throughout the entire processing flow.

[0033] At the same time, the received and decompressed file directories are scanned, and invalid data is eliminated according to preset filtering rules: hidden files, such as .thumbs.db and .DS_Store in Windows systems, or files set to hidden via file attributes, are directly deleted. Unrelated directories, such as document folders, log folders, and temporary cache directories uploaded by users by mistake, which do not contain any SHP-formatted files or supporting files, are detected by checking the file types in the directory and confirming that there are no valid files, and then the entire directory is deleted. The filtering operation only retains valid files containing SHP-formatted data and the directory structure in which they are located, reducing the amount of invalid data in subsequent processing steps.

[0034] Finally, the filtered, valid files are moved to a designated working directory according to pre-set directory structure rules. This working directory is organized hierarchically, for example, by creating subdirectories based on the original upload batch and file type. SHP master files and their supporting files uploaded in the same batch are stored in the same subdirectory, while maintaining the relationships between the files. For example, .shp, .shx, and .dbf files with the same name are stored in the same directory. This organization facilitates subsequent traversal of SHP files and access to complete data, improving 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 an output directory according to a preset file name mapping rule and overwriting strategy.

[0036] In some embodiments, a recursive scan is performed on the designated working directory and its subdirectories organized in step S101 to identify and extract all files with a .shp extension. During this scan, the complete path and file name (after standardization encoding in step S101) of each SHP file, as well as the existence of associated supporting files (e.g., .shx, .dbf, .prj, etc.), are recorded to ensure that the spatial data and attribute information of the files 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 the traversal. For example, the output format is explicitly specified during the conversion, such as DWG_R2018. This version takes into account both compatibility and functional integrity and is stably supported by mainstream CAD software (such as AutoCAD 2018 and above), avoiding image distortion or attribute loss caused by version differences. Furthermore, two key rules are implemented through function parameter configuration:

[0038] Preset file name mapping rules: Map the standardized file name of the SHP file including the relative path relationship directly to the output DWG file to ensure the consistency and traceability of the file name before and after conversion. For example, "Plot Boundary.shp" will correspond to "Plot Boundary.dwg" after conversion.

[0039] File overwrite strategy: Set the overwrite_output=True parameter. When a DWG file with the same name already exists in the output directory, the old file will be automatically overwritten to avoid conversion interruption caused by duplicate file names and ensure the continuity of batch processing.

[0040] Finally, the converted DWG files are automatically moved to the preset output directory and stored in a hierarchical structure corresponding to the SHP files in the working directory. For example, "Region A / Road.shp" in the working directory will be converted and stored as "Region A / Road.dwg" in the output directory. This categorization not only maintains the original relationship between files, but also provides a clear file index for subsequent batch image processing steps, reducing path retrieval time.

[0041] In some embodiments, optionally, before converting the SHP file to the DWG format, the SHP file is also preprocessed, including: extracting 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 relationships, 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 an error classification result; based on the error classification result, the SHP file is automatically corrected based on a preset repair algorithm, and the corrected SHP file replaces the original file.

[0042] It is understandable that during the SHP to DWG conversion process, some source data may contain geometric topology errors, such as self-intersection, multi-segment overlap, and unclosed polygons. Traditional CAD batch processing will directly report an error or skip it, resulting in incomplete results.

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

[0044] Specifically, the core data of geometric elements are extracted from the SHP file processed in step S101 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 relationships, such as the connection, inclusion or intersection relationship between line segments, and polygon boundary node sequence (the order of arrangement of vertices constituting the polygon boundary).

[0045] The extracted geometric element data is converted into graph structure data: the vertices of the geometric elements are used as node data, and the node attributes include coordinate values ​​and vertex types (such as polygon endpoints and line segment intersections); the line segment connection relationship between vertices is used as edge data, and the edge attributes include line segment length, direction angle, and connection strength (indicating the closeness of the line segment association); the relationship between nodes and edges constitutes a graph structure (undirected graph) to reflect 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. The model extracts and analyzes the input data layer by layer by learning the error features in the historical annotation data (such as graph structure patterns with topological errors such as self-intersection, overlap, and non-closure).

[0047] The model outputs error classification results, including error types, such as "self-intersection error", "multiple segment overlap", and "unclosed polygon", error locations, such as specific vertex coordinates, line segment index, and confidence (used to filter out low-confidence misjudgment results, such as results with a confidence level below 80% are marked as pending verification).

[0048] For the erroneous classification results output by the model, the preset repair algorithm is called to perform targeted corrections; for example, for unclosed polygon errors: the two endpoints of the polygon are identified (the closest non-connected vertices), transition line segments are generated through the linear interpolation algorithm, and the boundaries are completed to close the polygon, ensuring that the closing error is ≤ the preset value, such as 0.01mm (to meet the subsequent filling accuracy requirements).

[0049] For line segment overlap errors: detect the repeated node sequences of overlapping line segments, retain one of them as the baseline line segment, and delete the redundant line segments that are completely overlapped; if there is partial overlap, crop the overlapping area and only retain the non-overlapping independent line segment part.

[0050] For self-intersection errors: locate the intersection points of self-intersecting line segments, split the original line segments into multiple non-self-intersecting sub-segments, and retain reasonable sub-segment combinations based on the geometric context (such as the inside-outside relationship of the polygon) to eliminate intersection conflicts.

[0051] After the correction is completed, the corrected geometric element data is rewritten 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 the error type, coordinate changes before and after correction, and correction time.

[0052] In some embodiments, as Figure 2 As shown, 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, and outputs node features; the global pooling layer globally aggregates the node features output by the graph convolution layer, and generates a global feature vector by combining 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 the probability value of each category through the Softmax function to realize the classification of error types.

[0053] Specifically, for the input layer, for example, this layer serves as the data entry 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 the geometric elements, including vertex coordinates (X, Y, Z) and vertex types (such as polygon endpoints, line segment intersections) and other attributes; the edge data corresponds to the connecting segments between vertices, including line segment length, direction angle, overlap rate and other attributes; the graph structure relationship represents the relationship between nodes and edges through the adjacency matrix. The input layer performs format standardization on the received graph structure data (for example, normalizing the attribute values ​​to the range of [0,1], which will not be repeated in this embodiment), providing a unified format input for feature extraction in subsequent layers.

[0054] For example, the graph convolution layer contains three graph convolution units stacked in sequence. Each unit processes the input data according to the following process to achieve deep extraction of node features:

[0055] Adjacent node feature aggregation: For each node, all its adjacent nodes are identified through the 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 node features, such as capturing topological relationships such as intersections and overlaps between line segments.

[0056] Nonlinear feature transformation: Apply the ReLU activation function to the aggregated node feature vectors to enhance the model's ability to express complex topological features through nonlinear mapping, making the feature vectors easier to distinguish different types of geometric errors.

[0057] Batch normalization: Batch normalization is performed on the feature vector after activation function transformation. By calculating the mean and variance of the current batch of samples, the feature vector is standardized to the preset distribution (mean is 0, variance is 1), reducing the impact of feature distribution differences between batches on model training, suppressing overfitting and accelerating convergence.

[0058] After being processed sequentially by three graph convolution units, the output is a node feature vector containing local topological details and hierarchical features.

[0059] For example, the global pooling layer globally aggregates all node features output by the graph convolutional layer. For example, this is achieved by combining two pooling operations:

[0060] Max pooling: Extracts the maximum value of all nodes in each feature dimension to capture local features with significant discrimination in geometric elements, such as the intersection of self-intersecting line segments, the endpoints of unclosed polygons, and other key location features.

[0061] Average pooling: Calculates the average value of all nodes in each feature dimension and integrates the overall distribution characteristics of geometric elements, such as the average length of polygon boundaries, the average angle of line segments, and other features that reflect the overall topological structure.

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

[0063] For the classification layer, for example, this layer uses a fully connected neural network structure to map the global feature vector output by the global pooling layer to preset error categories, such as self-intersection, multi-segment overlap, unclosed polygon, and no error. Exemplarily, the fully connected neural network contains two hidden layers (for example, 128 and 64 neurons respectively), and uses the ReLU activation function to enhance the nonlinear fitting ability. Finally, the output is converted into probability values ​​for each category (the sum of the probabilities is 1) through the Softmax function. For example, if the probability of the "unclosed polygon" category of a certain 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, illustratively, specifically includes:

[0065] Construction of training dataset: Collect SHP file samples containing geometric topological errors, covering typical error types such as self-intersecting line segments, overlapping polygon boundaries, and unclosed surface features, while also incorporating normal samples without errors; label the geometric features in each sample, and clearly define the error type (label) and error location (such as self-intersecting coordinates, overlapping line segment index); understandably, you can also choose to use already labeled data samples and import them directly, without any invention or limitation.

[0066] The annotated geometric elements are converted into graph structure data (node ​​features, edge features, graph structure), and divided into training set and validation set in a ratio of 7:3.

[0067] Model initialization: Initialize the weight matrix and bias parameters of the graph convolution layer, and set the initial mean and variance of the batch normalization layer. Define the loss function as cross-entropy loss to measure the difference between the probability of the error type output by the model and the true label. Select the Adam optimizer and set the initial learning rate (such as 0.001) and weight decay coefficient (such as 1e-5).

[0068] Iterative training: Randomly extract batches of samples from the training set (for example, the batch size is set to 32), input them into the GCN model, and obtain the error type prediction results; calculate the loss value between the prediction results and the true label, and update the parameters of each layer of the model (weights, biases, batch normalization parameters) through the backpropagation algorithm;

[0069] After every 10 epochs of training, the model performance (accuracy and recall) is evaluated using the validation set. If the validation set accuracy does not improve after 5 consecutive epochs, the learning rate is reduced (multiplied by 0.5).

[0070] Repeat the above steps until the accuracy of the model on the validation set reaches a preset threshold (such as 95%) or the number of iterations reaches an upper limit (such as 200 epochs).

[0071] Step S103, a CAD filling algorithm based on a transaction mechanism, loads DWG files one by one according to the batch processing principle, and performs image processing on the DWG files, including: traversing all layers of the DWG file, generating a filling layer corresponding to the original layer, automatically identifying closed curve objects in the target layer, performing entity filling operations, and synchronizing colors and attributes.

[0072] In some embodiments, DWG files are extracted one by one from the output directory generated in step S102 in a batch processing manner. A CAD application is launched via a CAD automation interface (e.g., a COM component) and the individual DWG files are loaded into memory. During the loading process, memory resources occupied by the previously processed file are automatically released, preventing memory overflows caused by loading multiple files at once and ensuring stability during large-scale file processing.

[0073] Start a CAD transaction and include operations such as layer traversal and fill layer creation into transaction management to ensure the atomicity of operations. That is, all operations are either executed completely or rolled back in case of exceptions to avoid damage to graphic data.

[0074] For example, a secondary development DLL command developed based on C#, such as INDIAN_HATCHALL, is called to traverse all layers of the currently loaded DWG file, identify the attribute information of each layer, including layer name, color parameters, line type settings, etc., and filter out the target layer according to preset filtering rules, such as layer names containing keywords such as "boundary" and "plot".

[0075] For each target layer, a corresponding fill layer is automatically created. For example, 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 attributes and line type attributes of the fill layer are synchronized with the original layer through the CAD secondary development interface to ensure visual consistency.

[0076] In the transaction environment, entity objects are traversed layer by layer, and closed curve objects such as closed polylines and polygons are identified by parsing the geometric properties of the entities, such as the closed mark of polylines and the connection relationship of the boundary nodes of polygons.

[0077] For the identified closed curve, a Hatch object is created and the fill type is set to SOLID (solid fill). The closed curve is designated as the fill boundary, and the fill calculation is automatically completed. During the fill process, the color properties of the Hatch object remain the same as the original layer. After the fill is completed, it is moved to the corresponding fill layer.

[0078] Optionally, after completing the fill operation for a single DWG file, commit the transaction to save all changes, and then save the processed file to a temporary directory. If an exception occurs during the fill process, such as forced fill of a non-closed curve or operation failure caused by a locked layer, the transaction is automatically rolled back, and error information, such as the file name, error type, and timestamp, is logged. The current file is skipped and the next one is processed, ensuring the overall process is uninterrupted.

[0079] Step S104 , batch-merging the plurality of DWG files that have undergone image processing 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 Figure 3 As shown in Figure 2, the specific workflow of the merging algorithm includes:

[0081] A file merging algorithm developed based on a LISP script is initiated. The algorithm receives as input the directory path containing the DWG files processed in step S103. The algorithm recursively traverses the directory and its subdirectories, identifying all files with a .dwg extension. A list of files to be merged is generated and sorted according to preset rules, such as file name sorting or file modification time, to ensure a standardized merge order.

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

[0083] Load the DWG files to be merged one by one in the order listed, and insert each file as an external block into the merge container using LISP script commands. During the insertion process, the block insertion point is automatically calculated based on the spatial coordinate information of each file, ensuring that the graphic elements of different files maintain the correct spatial relationship within the container, such as geographic coordinate alignment.

[0084] After the block is inserted, immediately execute the "Explode" command to decompose the block into independent graphic elements, such as lines, fill entities, text, layers, etc., eliminating the restrictions of block references on graphic editing, so that all merged elements can be operated separately.

[0085] After all files are inserted and exploded, the algorithm calls CAD view adjustment commands, such as ZOOMEXTENTS, to automatically detect the coordinate extremes of all graphic elements in the merged container, illustratively including the maximum X, minimum X, maximum Y, and minimum Y coordinates. Based on the extreme values, it calculates the view range that can completely contain all graphics and adjusts the view to that range, ensuring that all contents can be displayed at once when the user opens the merged file, without the need for manual zooming.

[0086] Finally, after completing the view adjustment, the algorithm automatically saves the merged DWG file to the specified output directory. The file name is named according to the preset rules, such as "merge result_timestamp.dwg", and the merge log is recorded at the same time (including the number of files involved in the merge, the time taken to merge, whether there are any anomalies, etc.) to provide a basis for subsequent tracing.

[0087] Step S105: Automatically compress and package the merged DWG file and transmit it back.

[0088] In some embodiments, the merged DWG file generated in step S104 is compressed. The compression format may be the mainstream ZIP format. The compression process preserves the original file attributes (e.g., creation time, modification time, file permissions) and relative path structure, ensuring the integrity and identifiability of the decompressed file.

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

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

[0091] Specifically, the Helper class contains an ArcGIS operation module and a CAD operation module, each encapsulating its corresponding functional interfaces. For example, the ArcGIS module includes methods for reading SHP files (calling ArcPy's ListFeatureClasses function) and format conversion (calling the ExportCAD_conversion function). The CAD module includes methods for launching the application (creating a CAD instance via win32com.client), executing commands (sending LISP command strings to the CAD interface), and saving files. Each module shares configuration parameters (such as the output directory path and version number) through class member variables.

[0092] For example, the Helper class coordinates the operation timing of ArcGIS and CAD through an event-triggered mechanism. For example, when the ArcGIS module completes the SHP to DWG format conversion, it triggers a "Conversion Completed" event. The CAD module listens for this event and automatically launches the CAD application to begin the shape fill operation. This mechanism avoids hard-coded timing dependencies and ensures smooth operation between different software.

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

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

[0095] The first pre-processing module 401 is used to receive SHP format data files, automatically identify the file names and convert them into a standard encoding format, filter hidden files and irrelevant directories, and organize valid files into a designated working directory;

[0096] A traversal module 402 is configured to traverse the SHP files in the working directory, convert the SHP files into DWG format, and automatically classify the converted DWG files into an output directory according to a preset file name mapping rule and overwriting strategy;

[0097] Fill module 403 is used for a transaction-based CAD fill algorithm, loading DWG files one by one in batch processing principle, and performing 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 in the target layer, performing entity fill operations, and synchronizing colors and attributes;

[0098] a merging module 404 for merging the plurality of DWG files that have undergone image processing into a single DWG file in batches using 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;

[0099] The return module 405 is used to automatically compress and package the merged DWG file and return it.

[0100] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application. The method corresponding to the electronic device may be the method in the aforementioned embodiment, and its principle of solving the problem is similar to that of the method. The electronic device provided in an embodiment of the present application includes: at least one processor; and a memory communicatively connected to 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 execute the methods and / or technical solutions of the aforementioned multiple embodiments of the present application.

[0101] The electronic device may be a user device, or a device formed by integrating a user device and a network device via a network, or an application running on the above device. The user device includes, but is not limited to, various terminal devices such as computers, mobile phones, tablets, smart watches, and wristbands. The network device includes, but is not limited to, network hosts, single network servers, multiple network server sets, or a collection of cloud computing-based computers, and can be used to implement some of the processing functions required for setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing. Cloud computing is a type of distributed computing, consisting of a virtual computer composed of a group of loosely coupled computers.

[0102] Figure 5 The structure of a device suitable for implementing the method and / or technical solution in the embodiment 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 the program stored in the read-only memory (ROM) 502 or the program loaded from the storage part 508 into the random access memory (RAM) 503. Various programs and data required for system operation are also stored in the RAM 503. The CPU 501, ROM 502 and RAM 503 are connected to each other via 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 section 506 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), an LED display, an OLED display, etc., and a speaker; a storage section 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 section 509 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet.

[0104] In particular, the methods and / or embodiments in the embodiments of the present application can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. 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 performed.

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

[0106] Specifically, the present embodiment can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by an instruction execution system, device or device or used in combination with it.

[0107] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0108] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0109] The flow chart or block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the equipment, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code include one or more executable instructions for realizing the logical function of the specification. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs the function or operation of the specification, or can be implemented with a combination of dedicated hardware and computer instructions.

[0110] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a device claim may also be implemented by a single unit or device through software or hardware. Terms such as "first" and "second" are used to indicate names and do not imply any particular order.

Claims

1. A GIS data intelligent conversion and processing method, characterized in that: The following steps are involved: Step S101: Receive SHP format data files, automatically identify file names and convert them into standard encoding formats, filter hidden files and irrelevant directories, and organize valid files into a designated working directory; 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 an output directory according to a preset file name mapping rule and overwriting strategy; Step S103: A CAD fill algorithm based on a transaction mechanism loads DWG files one by one in batch processing and 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 in the target layer, performing entity fill operations, and synchronizing colors and attributes; Step S104, batch merging the plurality of DWG files that have undergone image processing into a single DWG file using a file merging algorithm, inserting the DWG file as a block and exploding it into independent elements during the merging process, and automatically adjusting the view range; Step S105: Automatically compress and package the merged DWG file and transmit it back; Before converting the SHP file into the DWG format, the SHP file is pre-processed, including: Extracting geometric element data from the SHP file to be converted and converting it into graph structure data, wherein the geometric element data includes point coordinates, line segment topological relationships, and polygon boundary node sequences, and the graph structure data includes 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 an error classification result; Based on the error classification result, the SHP file is automatically corrected based on a preset repair algorithm, and the corrected SHP file replaces the original file.

2. A GIS data intelligent conversion processing method according to claim 1, characterized in that: The graph convolutional 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, and outputs node features; The global pooling layer globally aggregates the node features output by the graph convolution layer, and generates a global feature vector by combining 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 the probability value of each category through a Softmax function to achieve error type classification.

3. A GIS data intelligent conversion processing method according to claim 1, characterized in that: The method traverses all layers of the DWG file, generates a fill layer corresponding to the original layer, automatically identifies the closed curve object of the target layer, performs a solid fill operation, and synchronizes the color and attributes, specifically: Call the secondary development DLL command to traverse all layers in the currently loaded DWG file, automatically identify the attribute information of each layer, and filter out the target layer based on the preset filtering rules; Based on each filtered target layer, a corresponding fill layer is automatically created, and the color and line type attributes of the fill layer are synchronized with the original layer based on the secondary development interface; The entity objects are traversed in sequence by layer, closed curves are identified by parsing the geometric properties of the entity objects, and the fill layer is solidly filled based on the Hatch object with the closed curves as the fill boundaries.

4. A GIS data intelligent conversion processing method according to claim 1, characterized in that: The file merging algorithm uses LISP scripts to automatically merge batches of DWG files. Specifically: Step S301, starting the LISP script to receive a directory path parameter of the DWG files to be merged, and generating a file list by recursively traversing all DWG files in the directory; Step S302: Create a blank DWG file as a merge container, load the files to be merged one by one in the order of the file list, and insert them into the container file as external blocks. After the blocks are inserted, execute the explode command to decompose the blocks into independent graphic entities. Step S303: Invoke the CAD view adjustment command to automatically calculate the coordinate extremes of all entity objects and adjust the view range to an area that can completely contain all graphics.

5. A GIS data intelligent conversion processing method according to claim 1, characterized in that: It also includes building a custom Helper class to implement the integration, specifically: The Helper class adopts a modular design, including an ArcGIS operation module and a CAD operation module, which respectively encapsulate corresponding functional interfaces. Each module shares configuration parameters through class member variables; an event triggering mechanism is used to coordinate the operation timing of ArcGIS and CAD. When the ArcGIS module completes the operation, the corresponding event is triggered, and the CAD module performs the corresponding operation after listening to the event; a top-level process control method is provided to call the sub-methods of each processing step in sequence and read the parameters of each step through the configuration file.

6. A GIS data intelligent conversion and processing device, characterized in that: include: The first pre-processing module is used to receive SHP format data files, automatically identify the file name and convert it into a standard encoding format, filter hidden files and irrelevant directories, and organize valid files into a specified working directory; A traversal module is used to traverse the SHP files in the working directory, convert the SHP files into DWG format, and automatically classify the converted DWG files into an output directory according to a preset file name mapping rule and overwriting strategy; A fill module is used for a transaction-based CAD fill algorithm, loading DWG files one by one in batch processing, and performing 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 in the target layer, performing entity fill operations, and synchronizing colors and attributes; a merging module, configured to batch merge the plurality of DWG files that have undergone image processing into a single DWG file using a file merging algorithm, inserting the DWG file as a block and exploding it into independent elements during the merging process, and automatically adjusting the view range; The return module is used to automatically compress and package the merged DWG files and return them; Before converting the SHP file into the DWG format, the SHP file is pre-processed, including: Extracting geometric element data from the SHP file to be converted and converting it into graph structure data, wherein the geometric element data includes point coordinates, line segment topological relationships, and polygon boundary node sequences, and the graph structure data includes 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 an error classification result; Based on the error classification result, the SHP file is automatically corrected based on a preset repair algorithm, and the corrected SHP file replaces the original file.

7. An electronic device, wherein: include: at least one processor; and a memory in communication with the processor; wherein, The memory stores instructions that can be executed by the processor, and the instructions are executed by the processor to enable the processor to perform the method according to any one of claims 1 to 5.

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

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

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

  • Data format conversion method and system, storage medium and program product

    CN119088759A

Cited By

  • Unmanned aerial vehicle autonomous inspection method, device, medium and equipment

    CN121635427A

  • Geographic library conversion method and device based on GIS technology, equipment, medium and product

    CN121636594A