A method for CAD drawing analysis and spatial data conversion
By standardizing CAD drawings, extracting point and line primitives, inferring semantic types, and assigning spatial relationships, and combining machine learning and topology construction, the problem of automatically parsing CAD drawings into GeoJSON format map data was solved, achieving efficient and accurate indoor map data generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2026-03-20
AI Technical Summary
Existing technologies struggle to efficiently and automatically extract structural information from CAD drawings and convert it into indoor map data that conforms to geographic information system (GIS) standards, resulting in low efficiency, unstable accuracy, and high costs, making large-scale deployment difficult.
This paper provides a method for parsing CAD drawings and converting spatial data, including data normalization, extraction of point and line primitives, semantic type inference, spatial relationship assignment and coordinate system reprojection, outputting GeoJSON format map data, and combining machine learning for semantic classification of text annotations and construction of spatial topology.
It enables automated parsing and structured conversion of CAD drawings, improving the automation and intelligence of converting drawing data into indoor maps. It supports multiple structured output formats and is suitable for scenarios such as WebGIS, indoor navigation, and emergency response.
Smart Images

Figure CN120671263B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of building information modeling (BIM), geographic information system (GIS), and digital twinning, and specifically relates to a CAD drawing analysis and spatial data conversion method, in particular, a technical solution for automatically analyzing building CAD drawings into indoor map data (Indoor Map). BACKGROUND
[0002] In many scenarios such as architectural design, property management, indoor navigation, and emergency response, indoor maps have become key basic data. However, the original data of indoor maps mostly comes from CAD drawings in the engineering design stage, such as floor plans, ceiling plans, electrical plans, etc. However, due to the lack of unified mapping standards and semantic specifications in CAD drawings, there are significant differences in layer naming, color coding, and element representation methods among different design units, which makes it very difficult to automatically extract structural information (such as walls, doors, rooms, paths) from CAD drawings.
[0003] Traditional processing methods usually rely on manual checking of layers and identifying of elements using AutoCAD or other CAD software, and then generating indoor map data through manual annotation or screenshot methods. This not only has low efficiency, but is also easily affected by human factors, resulting in unstable accuracy and high processing cost. At the same time, since traditional CAD operations rely on desktop software, users must have a certain mapping foundation, and ordinary data administrators or business personnel are difficult to quickly master, further limiting the deep utilization of CAD drawings in digital space management.
[0004] In addition, with the development of WebGIS, indoor navigation, digital building, and other applications, indoor map data needs to meet the requirements of unified coordinate system, clear spatial semantics, and high degree of structuring, while traditional CAD drawings only have geometric information and lack directly usable spatial semantic tags, so they need to be semantically enhanced and structurally converted.
[0005] Summary of Prior Art:
[0006] 1. Manual annotation + semi-automatic modeling method:
[0007] In this type of solution, the operator manually identifies elements such as walls, doors, and room numbers using AutoCAD, Revit, or other software, and uses plug-ins or intermediate software (such as FME, Navisworks) to output intermediate formats (such as Shapefile, IFC, CityGML), and then converts them into GeoJSON or indoor map format through post-processing.
[0008] Advantages:
[0009] The results are relatively accurate and suitable for important scenarios or small-scale processing.
[0010] Complex graphics can be combined with artificial knowledge to determine their meaning.
[0011] Disadvantages:
[0012] Dependence on manual operation, low efficiency, difficult to deploy on a large scale.
[0013] Strong subjectivity, poor consistency of results.
[0014] High cost, not suitable for rapid deployment scenarios.
[0015] 2. Image recognition algorithm (AI recognition):
[0016] Using deep learning or image processing technology, CAD drawings are converted into images to recognize graphics, extract wall, door and other spatial structures, such as Mask R-CNN, U-Net, etc. Model applied to building plan extraction.
[0017] Advantages:
[0018] Batch processing of image format drawings (PDF, DWG to image).
[0019] Suitable for automatic recognition of unstructured CAD files.
[0020] Disadvantages:
[0021] Training relies on large-scale high-quality labeled samples.
[0022] Geometric accuracy and spatial topology are difficult to guarantee.
[0023] Sensitive to drawing style, resolution, and interference elements.
[0024] Therefore, there is an urgent need for a CAD drawing intelligent parsing method for indoor space scenarios, which can automatically identify spatial components and construct structured indoor map data (such as GeoJSON, IndoorGML or custom format) to support subsequent path planning, visualization, indoor positioning and emergency response and other practical applications. SUMMARY
[0025] The main purpose of the present application is to provide a CAD drawing parsing and spatial data conversion method, which can automatically complete drawing parsing, feature extraction, semantic recognition and spatial conversion, and finally output GeoJSON format map data conforming to the use specification of geographic information system. This method solves the problems of CAD drawing data format confusion, low efficiency of manual processing, and lack of spatial semantics, significantly improving the automation and intelligence level of drawing data conversion to indoor map assets.
[0026] To achieve the above object, the present application provides a CAD drawing analysis and spatial data conversion method, comprising the following steps:
[0027] Step S1: CAD data normalization and format checking are performed to identify the overall layout and metadata integrity of the CAD drawing;
[0028] Step S2: point and line primitives are extracted and geometric construction is performed, and the extracted geometric data will be converted into a set of spatial features represented in a unified coordinate system;
[0029] Step S3: text-based semantic type inference is performed to automatically assign the functional space type;
[0030] Step S4: type assignment based on spatial relationships is performed;
[0031] Step S5: single-floor, multi-floor, and inter-building connected road networks are automatically generated based on map data;
[0032] Step S6: road network topology connectivity checking is performed;
[0033] Step S7: coordinate system recognition and re-projection are performed;
[0034] Step S8: GeoJSON format map data is output.
[0035] As a further preferred technical solution of the above technical solution, step S1 is specifically implemented as follows: first, the input CAD drawing is subjected to format recognition and normalization processing, supporting mainstream CAD file formats including DWG and DXF, and by analyzing basic information including layer structure, coding format and drawing unit, the overall layout and metadata integrity of the drawing are identified; in this process, data legality checking is performed on the CAD drawing, and automatic repair or prompt processing is performed.
[0036] As a further preferred technical solution of the above technical solution, step S2 is specifically implemented as follows: common primitives in CAD are classified and identified, including points and lines, and pre-processing is performed according to layer naming, color coding or primitive type, and the extracted geometric data will be converted into a set of spatial features represented in a unified coordinate system, and the specific analysis rules are as follows:
[0037] DXF file is composed of code-value pairs, which is parsed by custom parser piece by piece, and the metadata including layer information, graphic element type, reference relationship of BLOCK and INSERT, unit and reference point are extracted; in order to unify the graphic element structure, different types of graphic elements are standardized as standard geometric objects: LINE and LWPOLYLINE are converted into a collection of line segments; closed polylines are constructed into polygons; ARC and CIRCLE are approximated to polylines using angle interpolation method; the content of TEXT / MTEXT and its insertion point coordinates are extracted as spatial annotations.
[0038] As a further preferred technical solution of the above technical solution, step S3 is specifically implemented as: for the text annotations existing in the drawing, a keyword matching and natural language processing based method is adopted to infer the semantic type of adjacent regions, so as to realize automatic assignment of the functional space type; the spatial adjacency relationship between the text and the graphic element will be an important basis for semantic mapping;
[0039] In order to realize automatic semantic classification of text annotations in CAD drawings, a machine learning method is introduced, which combines text feature vectorization and classifier training to intelligently infer semantic labels of text content in drawings for identifying semantic attributes of room purpose and space function. The specific steps are as follows:
[0040] Step S3.1: training data preparation, the text annotations and their corresponding functional area types in the existing drawings are used as training samples;
[0041] Step S3.2: feature extraction method, feature vectorization is performed on the text content to extract the importance of words to support the subsequent classification algorithm;
[0042] Step S3.3: classification model training;
[0043] Step S3.4: model training and evaluation, the data set is divided into training set and test set, and after training, the indexes including accuracy, precision and recall rate are evaluated to ensure the generalization ability of the model;
[0044] Step S3.5: model application, in the automatic parsing stage of the drawing, the text graphic element is automatically extracted, its content is obtained and input into the trained model, the type label is predicted, and the label is assigned to the space region where it is located.
[0045] As a further preferred technical solution of the above technical solution, step S5 is specifically implemented as the following steps:
[0046] Step S5.1: Spatial object reconstruction and cleaning, geometric construction and cleaning operation is performed on the classified primitives, including identifying the position of the door based on the intersection relationship between the door line and the wall surface; using the room closure line to construct the face object, and calculating its centroid as the room center point; using Boolean operation to construct the corridor area, and performing redundant line merging and repeated vertex elimination;
[0047] Step S5.2: Building a single-floor connected graph, building a node V_i for each room centroid; for each door, determining the two rooms or a room and a corridor connected by spatial analysis, establishing an edge , and the edge weight is the Euclidean distance; introducing a corridor grid point as a navigation auxiliary node, building a corridor graph based on Delaunay triangular net or sparse Voronoi graph; outputting a single-floor connected graph structure containing node and edge information ;
[0048] Step S5.3: Building a cross-floor connection graph, identifying all elements including elevators, stairs, and multi-layer through escalators, and establishing a cross-layer edge by matching the same X-Y coordinates or numbers between different floors; for elevators, establishing the connection between nodes of different floors in the same elevator shaft; for stairs, generating a virtual edge from the exit of the first floor to the entrance of the second floor, and setting the cross-layer weight; generating a cross-layer graph with three-dimensional navigation capability in Z-axis dimension;
[0049] Step S5.4: Building a building-to-building connection, extracting the coordinates and relative geographical positions of the entrances and exits of each building, building an outdoor basic road network graph G_outdoor, and then connecting the indoor graph G_multi with the outdoor graph through the exit nodes to form a complete park-level path graph .
[0050] As a further preferred technical solution of the above technical solution, step S6 is specifically implemented as follows:
[0051] Step S6.1: Connected component detection, after building the preliminary connected graph, the following checking process is performed:
[0052] Graph traversal algorithm detects isolated subgraphs, uses depth-first search or breadth-first search algorithm to traverse all nodes; identifies all connected subgraphs ; if n>1, there are isolated rooms or areas;
[0053] Output the list of unconnected rooms, for the case where only room nodes are included in the isolated subgraph but no valid entrance and exit edges, record the room number of this type; and prompt manual checking of the CAD drawing for missing or incorrectly labeled doors;
[0054] Step S6.2: door connectivity verification, for each door graph element, verify that its two sides are indeed connected to valid room or corridor areas; based on the door's line segment normal vector and the buffer area, perform point-plane inclusion judgment on its two side areas; if there is only one space connected or both sides are space voids, mark it as an invalid door graph element; automatically remove invalid doors or prompt the user to manually check;
[0055] Step S6.3: cross-layer node consistency check, for cross-layer connected nodes such as stairs and elevators, perform the following verification:
[0056] Geometric position matching: the corresponding nodes on the upper and lower layers should have the same or similar XY coordinates;
[0057] Label consistency check: automatically match the upper and lower layer pairs according to the stair or elevator number; if there are unpaired nodes, consider it as a suspended cross-layer structure and prompt to complete or correct;
[0058] Step S6.4: broken edge repair and path completion, for some floors with small corridor breaks or door offset not connected, the following repair strategies are provided:
[0059] Space proximity point automatic bridging: if the distance between two nodes is less than a certain threshold, try to insert a supplemental edge to connect;
[0060] Path reachability optimization: run the shortest path algorithm to detect whether the path between core nodes is smooth, and if a broken link is found, try to repair it locally.
[0061] As a further preferred technical solution of the above technical solution, step S7 is specifically implemented as follows:
[0062] Through the drawing metadata or user-specified known point position; identify the projection zone used by the drawing; apply EPSG code to bind the original coordinate system;
[0063] Use the spatial projection conversion algorithm to convert the CGCS2000-based plane rectangular coordinates to the WGS84 geographic coordinate system to support browser map engine rendering.
[0064] The beneficial effects of the present application are:
[0065] I. Combination of graph element level semantic recognition and structure analysis:
[0066] For CAD drawing layers, colors, line types and other low-level information, combined with spatial geometric relationships and topological rules, automatically recognize typical space components (such as walls, doors, stairs, rooms, etc.). Support for non-standard layer naming engineering drawing analysis, with certain generalization ability.
[0067] II. Automatic construction of spatial topological structure:
[0068] Not only identify geometric elements, but also construct semantic topological relationships such as "room contains door", "wall adjacent to room", "passage path connectivity graph", etc. Support subsequent navigation map generation and path planning.
[0069] III. Support multiple structured output formats:
[0070] Support output GeoJSON, IndoorGML, CityJSON or custom data format, easy to access WebGIS or map engine. Can be connected to indoor navigation, digital twin, visualization platform and other scenarios.
[0071] IV. Modular and extensible:
[0072] The parsing process has modular design, supporting customized rule extension for different building types and drawing styles.
[0073] Can be integrated into BIM / GIS platform or called by business system through API service. BRIEF DESCRIPTION OF DRAWINGS
[0074] Figure 1 is a flowchart of the present application. DETAILED DESCRIPTION
[0075] The following description is used to disclose the present application so that those skilled in the art can implement the present application. The preferred embodiments in the following description are only as examples, and other obvious modifications can be thought of by those skilled in the art. The basic principles of the present application defined in the following description can be applied to other embodiments, modifications, improvements, equivalents and other technical solutions without departing from the spirit and scope of the present application.
[0076] In the preferred embodiment of the present application, those skilled in the art should note that the CAD drawings and the like involved in the present application can be regarded as prior art.
[0077] Preferred embodiment.
[0078] As shown in Figure 1 , the present application provides a method for CAD drawing analysis and spatial data conversion, comprising the following steps:
[0079] Step S1: CAD data standardization and format checking, identifying the overall layout and metadata integrity of the CAD drawing;
[0080] Step S2: Point, line element extraction and geometry construction, the extracted geometric data will be converted into a set of spatial features represented by unified coordinates;
[0081] Step S3: Text-based semantic type inference, automatic assignment of functional space (room) type;
[0082] Step S4: Perform type assignment based on spatial relationship (in addition to text, also integrate spatial relationship to identify and assign types to components, such as determining wall continuity through topological analysis, identifying corridors by passage width, identifying room areas by closed patterns, determining entrance direction by door and window position, etc.; based on spatial rules such as geometric relationship, adjacency logic, and size characteristics, perform type reasoning on unknown graph elements to improve identification accuracy and adaptability);
[0083] Step S5: Automatically generate single-floor, multi-floor, and inter-building connected road networks based on map data;
[0084] Step S6: Perform road network topology connectivity check;
[0085] Step S7: Perform coordinate system recognition and re-projection;
[0086] Step S8: Output GeoJSON format map data (organize the recognized and processed indoor space data (such as rooms, walls, doors, text annotations, etc.) into standard GeoJSON format, with necessary attribute information and spatial semantic labels, which can be directly used for WebGIS visualization, map rendering, path planning, navigation, etc. applications).
[0087] Specifically, step S1 is implemented as follows: First, the input CAD drawing is processed for format recognition and standardization, supporting mainstream CAD file formats including DWG and DXF, and by analyzing the basic information including layer structure, coding format and drawing unit, the overall layout and metadata integrity of the drawing are recognized; In this process, data legality check is performed on the CAD drawing (such as whether there are empty layers, repeated graph elements, non-standard coding, chaotic unit settings, etc.), and automatic repair or prompt processing is performed.
[0088] More specifically, step S2 is implemented as follows: Common graph elements in CAD are classified and recognized, including points (such as positioning marks, access control, etc.) and lines (such as walls, passages, boundaries), and pre-processing is performed according to layer naming, color coding or graph element type, and the extracted geometric data will be converted into a unified coordinate representation of spatial feature set, and the specific analysis rules are as follows:
[0089] The DXF file is composed of code-value pairs (including mainly segments such as HEADER, TABLES, BLOCKS and ENTITIES), which are parsed by a customized parser segment by segment, and the metadata including layer information (Layer), graphic element type (LINE, LWPOLYLINE, CIRCLE, TEXT, INSERT, etc.), reference relationship of BLOCK and INSERT, unit and reference point are extracted. In order to unify the graphic element structure, different types of graphic elements are standardized into standard geometric objects: LINE and LWPOLYLINE are converted into a set of line segments; closed polylines (LWPOLYLINE) are constructed into polygons; ARC and CIRCLE are approximated to polylines using angle interpolation method; the content of TEXT / MTEXT and its insertion point coordinates are extracted as spatial annotations (key points: judge the closed property: check whether the first and last points coincide; interpolate the arc: commonly interpolate 1 point to form a line segment every 5°; area filtering: ignore invalid small areas or isolated graphic elements).
[0090] Further, step S3 is specifically implemented as: for the text annotations (such as "outpatient room", "conference room", "power distribution room", etc.) existing in the drawing, a keyword matching and natural language processing based method is adopted to infer the semantic type of the adjacent area, so as to realize automatic assignment of the type of functional space (room); the spatial adjacency relationship between text and graphic elements (such as the text drop point in a certain closed polygon area) will be an important basis for semantic mapping;
[0091] In order to realize the automatic semantic classification of text annotations in CAD drawings, a machine learning method is introduced, which combines text feature vectorization and classifier training to intelligently infer the semantic labels of the text content in the drawings for identifying the semantic attributes of room purpose and space function. The specific steps are as follows:
[0092] Step S3.1: training data preparation, the text annotations and their corresponding functional area types in the existing drawings are used as training samples;
[0093] Step S3.2: feature extraction method, TfidfVectorizer is used to vectorize the text content and extract the importance of words (TF-IDF value) to support the subsequent classification algorithm;
[0094] Step S3.3: classification model training (supporting multiple classification models, including: Naive Bayes classifier: suitable for short text classification, fast and stable effect; Random Forest classifier: suitable for medium-sized data, with strong non-linear modeling ability);
[0095] Step S3.4: Model training and evaluation, the dataset is divided into training set and test set by train_test_split, and the indicators including accuracy, precision, recall are evaluated after training to ensure the generalization ability of the model;
[0096] Step S3.5: Model application (drawing analysis stage), in the automatic drawing analysis stage, the text elements (TEXT, MTEXT) are automatically extracted, their contents are obtained and input into the trained model, the type label is predicted, and the label is assigned to the space region where it is located (for example: the text is "meeting room", the model predicts "office space"; the text is "high-voltage distribution room", the model predicts "equipment room").
[0097] Further, step S5 is implemented as follows:
[0098] Step S5.1: Space object reconstruction and cleaning, the classified elements are geometrically constructed and cleaned, including identifying the position of the door based on the intersection relationship between the door line and the wall surface; using the room closure line to construct the face object and calculating its centroid as the room center point; using Boolean operation to construct the corridor region and performing redundant line merging and repeated vertex elimination;
[0099] Step S5.2: Constructing single-floor connected graph, constructing node V_i for each room centroid; for each door, determining the connected two rooms or room and corridor through spatial analysis, establishing edge with edge weight as Euclidean distance; introducing corridor grid points as navigation auxiliary nodes, constructing corridor graph based on Delaunay triangular net or sparse Voronoi diagram; outputting single-floor connected graph structure containing node and edge information ;
[0100] Step S5.3: Constructing cross-floor connection graph, identifying all elements including elevators, stairs, multi-layer through escalators, establishing one-to-one correspondence of connection points between different floors through the same X-Y coordinate or number matching method, establishing cross-layer edges; for elevators, establishing node connection between different floors in the same elevator shaft; for stairs, generating a virtual edge from the exit of the first floor to the entrance of the second floor, setting the cross-layer weight; generating cross-layer graph ( representing the road network connection graph between single floors, such as a building with 3 floors, that is, G_floor_1, G_floor_2, G_floor_3, where i represents the floor number, representing the road network connection graph between buildings, such as straight elevators, escalators, stairs, etc.), with three-dimensional navigation capability in Z-axis (floor) dimension;
[0101] Step S5.4: Building inter-building connection, extracting the coordinates of each building's entrance and relative geographical position, constructing an outdoor basic road network graph G_outdoor (which can be based on OpenStreetMap or artificial modeling), and then connecting the indoor graph G_multi and the outdoor graph through the exit node to form a complete park-level path graph .
[0102] Preferably, step S6 is implemented as the following steps (to ensure that the automatically generated connected path network graph has good topological connectivity and navigation accessibility, the present application further introduces a set of connectivity checking and correction algorithm based on graph theory and spatial analysis):
[0103] Step S6.1: Connected component detection, after the preliminary connected graph G = (V, E) is constructed, the following checking process is performed:
[0104] Graph traversal algorithm detects isolated subgraphs, uses depth-first search (DFS) or breadth-first search (BFS) algorithm to traverse all nodes; identifies all connected subgraphs ; if n>1, there are isolated rooms or areas;
[0105] Output the list of unconnected rooms, for the case where an isolated subgraph only contains room nodes but no valid entrance and exit edges, record the room number of this type; and prompt manual checking of the CAD drawing for missing or incorrectly labeled doors;
[0106] Step S6.2: Door connectivity verification, for each door graph element, verify that its two sides are indeed connected to valid rooms or corridor areas; based on the line segment normal vector of the door and the buffer area, perform point-surface inclusion judgment on the two side areas; if there is only one space (room or corridor) connected or both sides are empty, mark it as an invalid door graph element; automatically exclude invalid doors or prompt user to manually check;
[0107] Step S6.3: Cross-layer node consistency check, for the cross-layer connected nodes of stairs and elevators, perform the following verification:
[0108] Geometric position matching: the corresponding nodes on the upper and lower layers should have the same or similar XY coordinates;
[0109] Label consistency check: automatically match the upper and lower layer pairs according to the stair or elevator number; if there are unpaired nodes, consider them as suspended cross-layer structures and prompt to complete or correct;
[0110] Step S6.4: Edge repair and path completion, for the case where there are small sections of corridors broken or doors offset not connected in some floors, the following repair strategies are provided:
[0111] Space close to the point of automatic bridge: if the distance between two nodes is less than a certain threshold (such as 1 meter), try to insert the edge connection;
[0112] Path reachability optimization: run the shortest path algorithm to detect whether the path between core nodes is smooth, and if a broken link is found, try to repair it locally.
[0113] Preferably, step S7 is implemented as follows (most CAD drawings use a local plane rectangular coordinate system (such as a custom engineering coordinate system with a building corner point as the origin), which does not contain geographic coordinate information and cannot be directly used in the map engine. Through user input or drawing metadata recognition, the original coordinates are configured to the national standard coordinate system — China Geodetic 2000 coordinate system (CGCS2000). This coordinate system is widely used in engineering surveying and planning design, and has good compatibility with GPS coordinates):
[0114] Through the drawing metadata or user-specified known point position (such as the latitude and longitude corresponding to a point on the drawing); identify the projection band used by the drawing (such as Xi'an 38 band, i.e. EPSG:4547); apply EPSG code to bind the original coordinate system (such as: 3° band projection (EPSG:4490 + EPSG:4547) 6° band projection (such as EPSG:4507));
[0115] Using spatial projection conversion algorithm, convert the plane rectangular coordinates based on CGCS2000 to WGS84 geographic coordinate system (EPSG:4326) to support browser map engine (such as Mapbox, Leaflet, Cesium) rendering.
[0116] It is worth mentioning that the CAD drawings and other technical features involved in the present patent application should be considered as prior art. The specific structure, working principle and possible control method, spatial arrangement method of these technical features can be selected conventionally in the art, and should not be considered as the invention point of the present patent. The present patent will not be further expanded and detailed.
[0117] For those skilled in the art, the technical solutions described in the foregoing embodiments can be modified or some technical features can be replaced by equivalents. Any modification, equivalent replacement, improvement, etc. within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for parsing CAD drawings and converting spatial data, characterized in that, Includes the following steps: Step S1: Perform CAD data standardization and format check to identify the overall layout and metadata integrity of CAD drawings; Step S2: Extract and construct point and line primitives. The extracted geometric data will be transformed into a set of spatial elements with unified coordinate representation. Step S3: Perform text-based semantic type inference to automatically assign values to the functional space type; Step S3 is specifically implemented as follows: For text annotations in the drawings, semantic type inference is performed on adjacent areas using keyword matching and natural language processing, thereby achieving automatic assignment of functional space type; the spatial adjacency relationship between text and graphic elements will serve as an important basis for semantic mapping; To achieve automatic semantic classification of text annotations in CAD drawings, machine learning methods were introduced. By combining text feature vectorization and classifier training, the semantic labels of the text content in the drawings were intelligently inferred to identify the semantic attributes of room usage and spatial function. The specific steps are as follows: Step S3.1: Training data preparation, using the text annotations in the existing drawings and their corresponding functional area types as training samples; Step S3.2: Feature extraction method, which vectorizes the text content into features and extracts the importance of words to support subsequent classification algorithms; Step S3.3: Classification model training; Step S3.4: Model training and evaluation. Divide the dataset into training and testing sets, and evaluate metrics including accuracy, precision, and recall after training to ensure the model's generalization ability. Step S3.5: Model application. In the automatic drawing parsing stage, text primitives are automatically extracted, their content is obtained and input into the trained model, their type labels are predicted, and the label is assigned to the spatial region where they are located. Step S4: Assign type based on spatial relationships; Step S5: Automatically generate single-floor, multi-floor, and inter-building road networks based on map data; Step S5 is specifically implemented as follows: Step S5.1: Spatial object reconstruction and cleaning. Perform geometric construction and cleaning operations on the classified primitives, including identifying the position of the door based on the intersection relationship between the door line and the wall; constructing surface objects using the room closure line and calculating their centroid as the center point of the room; constructing the corridor area using Boolean operations and merging redundant lines and eliminating duplicate vertices. Step S5.2: Construct a single-floor connected graph, and create a node V_i for the centroid of each room; for each door, determine the two rooms it connects to or the room and the corridor through spatial analysis, and establish edges accordingly. The edge weights are Euclidean distances; corridor grid points are introduced as navigation auxiliary nodes, and a corridor graph is constructed based on Delaunay triangulation or sparse Voronoi diagram; the output is a single-layer connected graph structure containing node and edge information. ; Step S5.3: Construct a cross-floor connection graph, identify all elements including elevators, stairs, and multi-level connecting escalators, and match the connection points of different floors one-to-one using the same XY coordinates or numbering method to establish cross-floor edges; for elevators, establish connections between nodes on different floors within the same elevator shaft; for stairs, generate virtual edges from the first-floor exit to the second-floor entrance, and set cross-floor weights; generate the cross-floor graph. It has three-dimensional navigation capabilities along the Z-axis. Step S5.4: Building connection generation. Extract the entrance and exit coordinates and relative geographical locations of each building to construct the outdoor basic road network map G_outdoor. Then, connect the indoor map G_multi with the outdoor map through exit nodes to form a complete park-level path map. ; Step S6: Perform a road network topology connectivity check; Step S6 is specifically implemented as follows: Step S6.1: Connectivity Component Detection. After constructing the initial connected graph, the following inspection process is performed: Graph traversal algorithms detect isolated subgraphs by using depth-first search or breadth-first search to traverse all nodes; and identify all connected subgraphs. If n > 1, it indicates the existence of isolated rooms or areas. Output a list of disconnected rooms. For isolated subgraphs containing only room nodes but no valid entrance / exit edges, record the room number for that type. Also, prompt the user to manually check whether doors are missing or incorrectly labeled in the CAD drawings. Step S6.2: Door connectivity verification. For each door element, verify that it is indeed connected to a valid room or corridor area on both sides. Based on the line segment normal vector and buffer area of the door, perform point-face inclusion judgment on the areas on both sides. If there is only one space connected or both sides are empty spaces, mark it as an invalid door element. Automatically remove invalid doors or prompt the user to manually verify. Step S6.3: Cross-floor node consistency check. For cross-floor connectivity nodes of stairs and elevators, perform the following verification: Geometric position matching: Corresponding nodes in the upper and lower layers should have the same or approximately the same XY coordinates; Numbering consistency check: Automatically match upper and lower floors based on staircase or elevator number; if there are unmatched nodes, it is considered a suspended cross-floor structure, prompting for completion or correction; Step S6.4: Edge Repair and Path Completion. For some floors where there are small sections of broken corridors or misaligned doors, the following repair strategies are provided: Automatic bridging of nearby points in space: If the distance between two nodes is less than a certain threshold, attempt to insert a supplementary edge to connect them; Path reachability optimization: Run the shortest path algorithm to check whether the paths between core nodes are unobstructed. If a broken link is found, attempt to repair it locally. Step S7: Perform coordinate system identification and reprojection; Step S8: Output GeoJSON format map data.
2. The method for CAD drawing parsing and spatial data conversion according to claim 1, characterized in that, Step S1 is implemented as follows: First, the input CAD drawings are formatted and standardized, supporting mainstream CAD file formats including DWG and DXF. The overall layout and metadata integrity of the drawings are identified by parsing basic information including layer structure, encoding format and drawing units. During this process, the data legality of the CAD drawings is verified, and repair or prompt processing is performed automatically.
3. The method for CAD drawing parsing and spatial data conversion according to claim 2, characterized in that, Step S2 is specifically implemented as follows: Common graphic elements in CAD are classified and identified, including points and lines, and preprocessed according to layer naming, color coding, or graphic element type. The extracted geometric data will be transformed into a set of spatial elements with unified coordinate representation. The specific parsing rules are as follows: DXF files consist of code-value pairs, which are parsed segment by segment using a custom parser. The key extraction methods include layer information, primitive types, BLOCK and INSERT references, units, and reference points. To unify the primitive structure, different primitive types are standardized into standard geometric objects: LINE and LWPOLYLINE are converted into line segment sets; closed polylines are constructed into polygons; ARC and CIRCLE are approximated as polylines using angle interpolation; and the content of TEXT / MTEXT and their insertion point coordinates are extracted as spatial annotations.
4. The method for CAD drawing parsing and spatial data conversion according to claim 3, characterized in that, Step S7 is specifically implemented as follows: Identify the projection zone used in the drawing by using drawing metadata or user-specified known point locations; apply EPSG code to bind the original coordinate system; A spatial projection transformation algorithm is used to convert the CGCS2000-based Cartesian coordinates to the WGS84 geographic coordinate system to support browser map engine rendering.
Citation Information
Patent Citations
Indoor position service-oriented navigation network construction method
CN110543721A
System and method for constructing indoor map based on CAD electronic drawing
CN114065351A