Method and system for converting CAD drawing into spatial data and making map
Through multi-threaded tasks and dynamic slicing technology, combined with interpolation algorithms, the problems of poor cross-platform compatibility, low processing efficiency and lack of collaborative functions in CAD data conversion are solved, and efficient and accurate CAD file conversion and cross-platform real-time collaborative editing are achieved, improving conversion speed and rendering efficiency.
Patent Information
- Application Number
- CN202510700877.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-09-23
AI Technical Summary
Existing technologies have problems with converting CAD data into spatial data, such as poor cross-platform compatibility, low processing efficiency, missing data attributes, rendering performance bottlenecks, and lack of collaborative functions, making it difficult to achieve efficient, accurate, and real-time collaborative conversion and mapping.
It adopts multi-threaded conversion tasks, dynamic slicing technology and interpolation algorithms, including ring, elliptical arc, Bezier curve and other algorithms, automatically maps attribute fields, supports multi-user cross-platform collaborative editing, uploads and stores CAD files through the Web, builds a multi-level map tile pyramid, and realizes fast rendering and data display.
It achieves efficient and accurate CAD file conversion, reduces data redundancy, improves conversion speed and rendering efficiency, supports real-time collaborative editing across platforms and applications, and solves the problems of front-end loading crashes and missing data attributes.
Smart Images

Figure CN120687411A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of geographic information processing and computer-aided design technology, and in particular relates to a method and system for converting CAD drawings into spatial data and making maps. Background Art
[0002] CAD software systems have closed underlying technologies, complex and diverse feature styles, and spatial maps are difficult to directly access and use. With the development of information technology, how to quickly, efficiently, and conveniently convert large numbers of CAD drawings into spatial formats and quickly load them into maps for application has become a major research direction in the current geographic information industry.
[0003] Currently, the main methods for converting CAD data into spatial data include two categories: one is based on browser plug-ins, which relies on the installation of specific plug-ins, has poor cross-platform compatibility and low processing efficiency; the other is through background server parsing, but has the following defects: 1. Missing data attributes: only graphic information is retained after conversion, lacking attribute fields and drawing styles, and requires manual completion, which is inefficient and prone to errors; 2. Rendering performance bottleneck: Direct calls to large-scale data files cause front-end loading crashes, and lack dynamic slicing technology optimization; 3. Algorithm limitations: The conversion accuracy of complex graphics (such as elliptical arcs and Bezier curves) is insufficient, resulting in data deformation or redundancy; 4. Lack of collaborative functions: does not support multi-user real-time editing and cross-platform collaboration.
[0004] For example, Chinese invention patent CN112100123B discloses a method for layered display of large amounts of CAD files on a web front-end. The method includes the following steps: Step 1: The web front-end uploads the CAD file to be displayed to the server; Step 2: The server saves the data and opens the CAD file; Step 3: Obtains the number of features and the number of server cores; Step 4: Constructs multiple subtask information based on the unique identifiers of the features; Step 5: Starts multiple sub-processes based on the number of server cores, and executes the sub-tasks in a loop until all tasks are processed and converted into corresponding JSON files; Step 6: Returns all converted JSON files to the front-end; Step 7: The front-end performs a visual display using the obtained JSON files. While this solution improves data loading efficiency, it does not address issues such as automatic attribute assignment, dynamic slicing, and multi-algorithm fitting.
[0005] Therefore, there is an urgent need for a CAD conversion and drawing technology that is efficient, high-precision, and supports real-time collaboration. Summary of the Invention
[0006] In response to the problems raised by the above background technology, the purpose of the present invention is to provide a method and system for converting CAD drawings into spatial data and map making, so as to realize convenient and efficient conversion of CAD data, automatic map making configuration, fast rendering and loading display, and online real-time collaboration across platforms, systems and applications, and has the characteristics of strong practicality and high flexibility.
[0007] In order to achieve the above technical objectives, the technical solutions adopted by the present invention are as follows:
[0008] A method for converting spatial data from CAD drawings and making maps, comprising the following steps:
[0009] S1: Data upload: upload CAD files to the backend server through the Web terminal and store them, and detect and verify the CAD file coordinate system;
[0010] S2: Layer catalog parsing and selection configuration, parsing the layer catalog and element information of the CAD file stored in the backend server, and selecting the layer to be converted;
[0011] S3: Build a multi-threaded conversion task and use algorithms to fit spatial data to graphic elements;
[0012] S4: Store the converted spatial data into the database and build the attribute field and style mapping relationship;
[0013] S5: Generates a map tile pyramid based on dynamic slicing technology and publishes the map service address;
[0014] S6: The front-end calls the service address for rendering, supporting real-time collaborative editing and data export.
[0015] It is further defined that the algorithm extracts geometric parameters of CAD primitive information and generates discrete interpolation points based on preset interpolation rules, and constructs closed or open geometric figures by sequentially connecting them. The algorithm supports customization of interpolation point density to balance accuracy and data volume.
[0016] The algorithm includes at least one of the following:
[0017] Ring interpolation algorithm: parses CAD primitive information and generates polygonal fitting by evenly dividing the ring;
[0018] Elliptical arc interpolation algorithm: parses CAD primitive information and calculates interpolation points based on the major axis, minor axis, and deflection angle;
[0019] Arc / elliptical arc interpolation algorithm: parses CAD primitive information, divides interpolation points according to arc range, and corrects coordinate offsets based on rotation angle to ensure smooth arcs;
[0020] Ellipse interpolation algorithm: Analyze CAD primitive information, calculate interpolation points through major axis, minor axis and deflection angle, and achieve accurate fitting of the rotated ellipse;
[0021] Bezier curve fitting algorithm, which parses CAD primitive information and generates smooth curves based on control point weights;
[0022] Polyline convex point fitting algorithm: parses CAD polyline elements, distinguishes between straight segments and arc segments, analyzes convex point parameters in segments and fits them independently, and finally merges them into continuous spatial data;
[0023] Text parsing algorithm: parses CAD text files, parses font outlines into polyline sets, and repairs outline breaks or overlaps through topology detection.
[0024] It is further defined that the dynamic slicing technology of S5 includes real-time generation of multi-level map tiles according to data display accuracy requirements, and optimization of front-end loading efficiency through a pyramid structure.
[0025] It is further defined that the attribute field construction in step S4 includes automatically mapping the CAD layer style to the spatial data attribute table.
[0026] It is further defined that the real-time collaborative editing includes multiple users performing feature drawing, attribute modification and map overlay operations simultaneously across platforms.
[0027] A system for converting CAD drawings into spatial data and making maps, comprising a file uploading module, a parsing module, a conversion module, a database module, a slicing module and a collaboration module;
[0028] The file upload module is used to receive and store CAD files;
[0029] The parsing module is used to extract layer and element information;
[0030] The conversion module executes multi-threaded tasks and interpolation algorithms to generate spatial data;
[0031] The database module stores spatial data and attribute mapping relationships;
[0032] The slicing module constructs a map tile pyramid and generates a service address;
[0033] The collaboration module supports front-end rendering and multi-user real-time editing.
[0034] It is further defined that the conversion module includes a ring interpolation submodule and an ellipse fitting submodule, the ring interpolation submodule configures a default 72 interpolation points to generate a closed ring, and the ellipse fitting submodule calculates the interpolation points based on the major axis, minor axis and deflection angle.
[0035] It is further defined that the slicing module supports dynamic adjustment of tile levels according to user requests to reduce data transmission volume.
[0036] It is further defined that the collaboration module integrates version control functions, records user operation history and supports data backtracking.
[0037] It is further defined that the CAD file supports exporting spatial data in DXF, Shapefile, and PDF formats, and is compatible with GIS and CAD platforms.
[0038] Beneficial effects of the present invention:
[0039] This method independently selects CAD file layers and constructs conversion tasks in layers. Using spatial conversion and fitting algorithms such as circular interpolation, circular arc interpolation, elliptical interpolation, elliptical arc interpolation, Bezier curve fitting, text parsing, and polyline convex point fitting to circular arcs, it achieves rapid and efficient conversion of elements across CAD file layers. The converted data is highly accurate, stable, and reliable, with minimal data redundancy. Specifically, multi-threaded tasks and optimization algorithms significantly increase conversion speed compared to traditional methods; interpolation algorithms reduce graphic distortion and significantly reduce redundant data; and dynamic slicing technology significantly shortens front-end loading time.
[0040] At the same time, dynamic real-time slicing technology is used to construct a tile pyramid of the converted spatial data map, combined with automatic configuration of map drawing styles and map service construction rules, to support different users' rapid cross-platform and cross-application calling, loading, rendering and display, and online real-time collaborative editing, effectively solving problems such as the front-end call rendering and loading file size limit and data cross-platform call limit, and greatly improving the call rendering and display efficiency of large-scale CAD file layer spatial data. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The present invention can be further illustrated by the non-limiting examples given in the accompanying drawings;
[0042] Figure 1 The present invention provides a flowchart of the steps of a method and system for converting CAD drawings into spatial data and making maps. DETAILED DESCRIPTION
[0043] In order to enable those skilled in the art to better understand the present invention, the technical solutions of the present invention are further described below in conjunction with the accompanying drawings and embodiments. The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts are within the scope of protection of the present invention.
[0044] It should be noted that all directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the various components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0045] In addition, the descriptions of "first", "second", etc. in the present invention are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention. It should be understood that the specific embodiments described here are only used to explain the present invention and are not used to limit the present invention.
[0046] like Figure 1 As shown, a method for converting CAD drawings into spatial data and making maps of the present invention comprises the following steps:
[0047] S1: Data upload: upload CAD files to the backend server through the Web terminal and store them, and detect and verify the CAD file coordinate system;
[0048] Specifically, the detection supports detection of coordinate systems such as XIAN80, CGCS2000, WGS84, and GCJ02.
[0049] S2: Layer catalog parsing and selection configuration, parsing the layer catalog and element information of the CAD file stored in the backend server, and selecting the layer to be converted;
[0050] Specifically, the CAD file saved in the backend server is parsed and the file layer list is obtained. The information of the points, lines, surfaces, text and other types of elements contained in each layer is parsed and obtained, and the geometric topological relationship of each element is parsed and obtained. The user can select the layer to be converted into spatial data according to the parsed CAD file layer list, including the following two methods:
[0051] 1. Select All: Select all CAD file layers;
[0052] 2. Self-selection: Self-select some CAD file layers.
[0053] S3: Build a multi-threaded conversion task and use algorithms to fit spatial data to graphic elements;
[0054] S4: Store the converted spatial data into the database and build the attribute field and style mapping relationship;
[0055] Specifically, users select the spatial feature layers to be converted and the number of features in each layer according to their needs, and then construct feature conversion tasks in batches; multiple conversion tasks are started in parallel and executed in a loop until all tasks are completed. During the execution process, circular interpolation, circular arc interpolation, elliptical interpolation, elliptical arc interpolation, Bezier curve fitting, polyline convex point fitting, text parsing and other algorithms are used to quickly convert the features of each layer. The main function of each algorithm is to ensure that the CAD layer features are not lost or deformed after conversion, and the data is not redundant. The conversion process of different features during the conversion process is as follows:
[0056] Point conversion process:
[0057] 1. Parse the CAD layer point element information to obtain the point element type and coordinate location information;
[0058] 2. Generate point type spatial data based on coordinate position information.
[0059] Straight line conversion process:
[0060] 1. Parse the line element primitive information of the CAD layer to obtain the line element type and the coordinate position information array of the two end points;
[0061] 2. Generate two endpoint spatial data based on the two endpoint coordinate position information array;
[0062] 3. Connect the two endpoints to generate straight line spatial data.
[0063] Polygon conversion process:
[0064] 1. Parse the polygon element primitive information in the CAD layer to obtain the polygon element type and polygon inflection point position information array;
[0065] 2. Generate inflection point spatial data in sequence according to multiple inflection point coordinate position information arrays;
[0066] 3. Generate closed polygon line spatial data by sequentially connecting the inflection point spatial data;
[0067] 4. Perform closure detection on polygonal line spatial data and generate polygonal surface spatial data after closure detection.
[0068] Ring interpolation algorithm: parses CAD primitive information and generates polygonal fitting by evenly dividing the ring;
[0069] The circular interpolation algorithm specifically includes the following steps: first, the coordinates of the center point and radius of the circular ring in the graphics are obtained by parsing the CAD primitive information, and 72 points (default, customizable) are obtained through average distribution to form a 72-sided shape close to the circular ring. Then, the arc of each interpolation point is calculated based on the number of interpolation times. The coordinates of the interpolation point are then calculated using the arc, radius, and center point coordinates of the circular ring. Finally, all the interpolation points are fitted and all discrete interpolation points are connected in a clockwise direction to form a closed circular ring that meets the spatial data geometry standards.
[0070] The specific process of ring conversion based on the ring interpolation algorithm is as follows:
[0071] 1. Obtain the coordinates of the center point and radius of the ring through the ring element information in the CAD layer;
[0072] 2. Divide the 360° range into 72 equal parts (default, the number of divisions can be customized. The larger the number of divisions, the higher the conversion fitting accuracy and the larger the data volume), and the angle difference of each part is 5°;
[0073] 3. Generate the starting point coordinate information based on the center point coordinates and the circle radius starting from 0°, and then increase the calculation by 5° to generate the 72 interpolation point coordinate information arrays;
[0074] 4. According to the coordinate arrays of 72 interpolation points, connect and fit them in sequence to generate the annular space data.
[0075] Arc interpolation algorithm: parses CAD primitive information, divides interpolation points according to arc range, and corrects coordinate offsets based on rotation angle to ensure smooth arcs;
[0076] The arc interpolation algorithm specifically includes: first, parsing the coordinates of the center point of the circle, the radius of the circle, the starting arc, and the ending arc in the graphics obtained by analysing the CAD primitive information to determine the number of interpolation times, and then calculating the arc of each interpolation point based on the number of interpolation times, the starting arc, and the ending arc. Then, the coordinates of the interpolation point are calculated by the arc and radius of the interpolation point and the coordinates of the center point. Finally, all the interpolation points are fitted, and all discrete interpolation points are connected in a clockwise direction to form an arc graphic that meets the spatial data geometry standards.
[0077] Arc conversion process based on arc interpolation algorithm:
[0078] 1. Analyze the arc element information in the CAD layer to obtain the arc center point coordinates, arc radius, start angle, and end angle;
[0079] 2. Calculate the angle difference between the ending angle and the starting angle, assuming the angle difference is 144°;
[0080] 3. Divide the angle difference range into 72 equal parts (default, the number of divisions can be customized. The larger the number of divisions, the higher the conversion fitting accuracy and the larger the data volume), and the angle difference of each part is 2°;
[0081] 4. Generate the coordinate information of the arc starting point based on the center point, arc radius, and starting angle, and generate an array of 72 interpolation point coordinate information by increasing the value by 2°.
[0082] 5. According to the coordinate arrays of 72 interpolation points, connect and fit in sequence to generate arc space data.
[0083] Ellipse interpolation algorithm: Analyze CAD primitive information, calculate interpolation points through major axis, minor axis and deflection angle, and achieve accurate fitting of the rotated ellipse:
[0084] The ellipse interpolation algorithm specifically includes: first, parsing the CAD primitive information to obtain the coordinates of the ellipse center point, minor axis endpoint coordinates, major endpoint coordinates, and minor endpoint coordinates; according to the endpoint coordinates, calculating the ellipse deflection angle, calculating the major axis and minor axis lengths, and determining the number of interpolation points; then, calculating the arc of each interpolation point according to the number of interpolation points; then, calculating the offset of each interpolation point relative to the center point according to the arc of the interpolation point and the major axis and minor axis distances; finally, calculating the interpolation point coordinates through the center point coordinates and the center point offset; finally, fitting all interpolation points, and connecting all discrete interpolation points in a clockwise direction to form an ellipse figure that meets the spatial data geometry standards.
[0085] Ellipse conversion process based on ellipse interpolation algorithm:
[0086] 1. Parse the ellipse element primitive information in the CAD layer to obtain the coordinates of the ellipse center point, major axis endpoint coordinates, and minor axis endpoint coordinates;
[0087] 2. Calculate the major axis radius and minor axis radius based on the center point coordinates, major axis endpoint coordinates, and minor axis endpoint coordinates;
[0088] 3. Based on the center point coordinates as the starting point, generate a straight line in the horizontal 0° direction, generate a straight line in the vertical 90° direction of the long axis, and obtain the coordinates of the intersection of the two straight lines;
[0089] 4. Calculate the length between the intersection point and the center point based on the coordinates of the intersection point and the center point;
[0090] 5. Calculate the deflection angle of the ellipse based on the inverse tangent function;
[0091] 6. Divide the 360° range into 72 equal parts, with an angle difference of 5° between each part;
[0092] 7. Default the deflection angle to 0°, the horizontal axis to the horizontal, and the vertical axis to the vertical. With the horizontal axis endpoint at 0° as the starting point, calculate the horizontal distance from the center point to the starting point by multiplying the major axis radius by the cosine of 0°. Calculate the vertical distance from the center point to the starting point by multiplying the minor axis radius by the sine of 0°. Sum the horizontal coordinate of the center point with the horizontal distance, and sum the vertical coordinate of the center point with the vertical distance to obtain the horizontal and vertical coordinates of the starting point.
[0093] 8. Generate the coordinate information array of 72 interpolation points at 5° intervals;
[0094] 9. Generate ellipse spatial data by sequentially connecting and fitting the 72 interpolation point coordinate arrays;
[0095] 10. Taking the center point of the ellipse as the base point and the deflection angle as the rotation angle, the fitted ellipse is rotated as a whole to obtain spatial data consistent with the ellipse feature of the CAD layer.
[0096] Elliptical arc interpolation algorithm: parses CAD primitive information and calculates interpolation points based on the major axis, minor axis, and deflection angle;
[0097] The elliptical arc interpolation algorithm specifically includes: first, parsing the CAD primitive information to obtain the coordinates of the ellipse center point, minor axis endpoint coordinates, major endpoint coordinates, and minor endpoint coordinates; according to the endpoint coordinates, calculating the ellipse deflection angle, calculating the major axis and minor axis lengths, determining the number of interpolation points, and calculating the arc of each interpolation point according to the number of interpolation points; then, according to the arc of the interpolation point and the major axis and minor axis distances, calculating the offset of each interpolation point relative to the center point; finally, the interpolation point coordinates are calculated through the center point coordinates and the center point offset; finally, all interpolation points are fitted, and all discrete interpolation points are connected in a clockwise direction to form an elliptical arc graphic that meets the spatial data geometry standards.
[0098] The specific process of ring conversion based on the elliptical arc interpolation algorithm is as follows:
[0099] 1. Parse the ellipse element primitive information in the CAD layer to obtain the ellipse center point coordinates, major axis endpoint coordinates, minor axis endpoint coordinates, start angle, and end angle;
[0100] 2. Calculate the major axis radius and minor axis radius based on the center point coordinates, major axis endpoint coordinates, and minor axis endpoint coordinates;
[0101] 3. Based on the center point coordinates as the starting point, generate a straight line in the horizontal 0° direction, generate a straight line in the vertical 90° direction of the long axis, and obtain the coordinates of the intersection of the two straight lines;
[0102] 4. Calculate the length between the intersection point and the center point based on the coordinates of the intersection point and the center point;
[0103] 5. Calculate the deflection angle of the ellipse based on the inverse tangent function;
[0104] 6. Calculate the angle difference between the ending angle and the starting angle. If the angle difference is 72°;
[0105] 7. Divide the angle difference range into 72 equal parts, with each part having an angle difference of 1°;
[0106] 8. Using the arc's starting point as the starting point, calculate the horizontal distance from the center point to the starting point by multiplying the major axis radius by the cosine of the starting angle. Calculate the vertical distance from the center point to the starting point by multiplying the minor axis radius by the sine of the starting angle. Sum the horizontal coordinate of the center point with the horizontal distance, and sum the vertical coordinate of the center point with the vertical distance to obtain the horizontal and vertical coordinates of the starting point.
[0107] 9. Generate 72 interpolation point coordinate information arrays in 1° intervals;
[0108] 10. According to the generated 72 interpolation point coordinate arrays, connect and fit them in sequence to generate elliptical arc spatial data;
[0109] 11. Taking the ellipse center as the base point and the deflection angle as the rotation angle, the fitted elliptical arc is rotated as a whole to obtain spatial data consistent with the elliptical arc feature of the CAD layer.
[0110] Bezier curve fitting algorithm: parses CAD primitive information and generates smooth curves based on control point weights;
[0111] The Bezier curve fitting algorithm specifically includes: obtaining a set of curve control point coordinates, creating a linear difference sequence and recursively calculating the number of control point combinations, traversing and calculating the weight from each control point to the last control point and the weight from the first control point to the control point, and generating the fitting point coordinates based on the weights and control point coordinates, binomial coefficients, and the number of control point combinations, and connecting each control point and fitting point in sequence to achieve smooth curve construction.
[0112] Spline curve conversion process based on Bezier curve fitting algorithm:
[0113] 1. Parse the spline curve element primitive information in the CAD layer to obtain the coordinate array of the curve control points;
[0114] 2. Create a linear interpolation sequence and determine the order from the starting point to the end point of the linear interpolation;
[0115] 3. Recursively calculate the number of control point combinations;
[0116] 4. Traverse and calculate the weight from each control point to the last control point and the weight from the first control point to the control point;
[0117] 5. Generate one interpolation point coordinate based on the weight, control point coordinates, binomial coefficient, and control point combination of the first linear interpolation sequence. Generate multiple linear interpolation point coordinate information arrays in sequence based on the linear interpolation sequence.
[0118] 6. According to the linear interpolation point coordinate information array, the spline curve spatial data is connected and fitted in sequence.
[0119] Polyline convex point fitting algorithm: parses CAD polyline elements, distinguishes between straight segments and arc segments, analyzes convex point parameters in segments and fits them independently, and finally merges them into continuous spatial data;
[0120] The polyline convex point fitting algorithm specifically involves parsing CAD polyline elements, such as a polyline composed of lines and arcs. It then obtains the polyline's convex points, endpoints, and coordinates. It then calculates the arc radius and center point coordinates based on the convex points and endpoints. It then calculates the deflection angle based on the center point. The arc is then evenly divided into 72 interpolation points (by default, adjustable). The coordinates of each interpolation point are then calculated based on the arc, radius, and center point coordinates to form the polyline spatial data.
[0121] Polyline conversion process based on polyline convex point fitting algorithm:
[0122] 1. Parse the polyline feature source information in the CAD layer to obtain the number of polyline segments and the combination of the starting point and convex point of each segment; if the convex point is 0, it means the polyline is a straight line, and if the convex point is not zero, it means the polyline is an arc;
[0123] 2. Based on the starting point coordinates, end point coordinates, and convex point values of the first segment of the polyline, when the convex point value is 0, refer to the straight line fitting step to generate the endpoint coordinates of the segment; when the convex point value is not 0, refer to the arc fitting step to generate the coordinates of each interpolation point of the arc segment;
[0124] 3. Generate the coordinates of different endpoints or arc interpolation points in a loop according to the starting points, end points, and convex points of different line segments until the coordinates of all line segment fitting interpolation points are calculated;
[0125] 4. Combine all the fitted interpolation point coordinates to generate a polyline interpolation point coordinate information array;
[0126] 5. According to the coordinate information arrays of all interpolation points, connect and fit in sequence to generate polyline spatial data.
[0127] Text parsing algorithm: parses CAD text files, parses font outlines into polyline sets, and repairs outline breaks or overlaps through topology detection.
[0128] The text parsing algorithm specifically includes: parsing the ttf text file in the CAD file, obtaining the text outline and its coordinate information, and generating text space data based on the coordinate information.
[0129] Text conversion process based on text parsing and spatial data conversion algorithm:
[0130] 1. Parse the ttf text file in the CAD file to obtain the text source information and outline;
[0131] 2. Refer to the polyline fitting steps to generate the text outline interpolation coordinate information array;
[0132] 3. Generate text contour line spatial data by sequentially connecting and fitting according to the contour interpolation coordinate information array;
[0133] 4. Perform spatial geometric topology detection on the contour line spatial data generated sequentially and perform automatic repair and optimization.
[0134] In the actual application of this embodiment, the dynamic slicing technology of S5 includes generating multi-level map tiles in real time according to the data display accuracy requirements, and optimizing the front-end loading efficiency through the pyramid structure.
[0135] In practical applications of this embodiment, the attribute field construction in step S4 includes automatically mapping the CAD layer style to the spatial data attribute table.
[0136] In practical applications of this embodiment, the real-time collaborative editing includes multi-user cross-platform synchronous feature drawing, attribute modification, and map overlay operations.
[0137] S5: Generates a map tile pyramid based on dynamic slicing technology and publishes the map service address;
[0138] S6: The front-end calls the service address for rendering, supporting real-time collaborative editing and data export.
[0139] The specific process of S5 and S6 is as follows:
[0140] 1. Each CAD file layer is converted into spatial data in geojson format and stored in a spatial database according to the spatial data layer layer for unified storage and management.
[0141] 2. Based on the map-drawing style requirements for each feature in the CAD file layer, create the relevant attribute field structure in each spatial data layer attribute table, establish a mapping relationship between the map-drawing style of each layer in the original CAD file and the attribute fields of the spatial data layer, and assign the map-drawing style attributes of each layer in the original CAD file to each spatial data layer attribute table. The attribute table construction and assignment fields mainly include: layer name, feature type, feature symbol, linearity, width, transparency, size, fill color, etc., and can be independently expanded according to the map-drawing style requirements of the CAD data.
[0142] 3. According to the requirements of data display accuracy, the spatial layer data in the database is sliced in real time and dynamically, and spatial data map tile pyramids of different levels are constructed. The more pyramid slice levels there are, the more levels of data can be displayed, and the larger the pyramid levels, the higher the data display accuracy.
[0143] 4. Automatically configure map feature symbols, linearity, width, transparency, size, fill color, and other map mapping styles based on the converted map mapping style fields of each spatial data layer.
[0144] 5. Generate a map service address containing a map tile pyramid and corresponding layer map cartography style configuration according to the map service publishing address construction rules.
[0145] 6. The web front end calls and parses the map service address to dynamically obtain the map tile pyramid data at all levels and map mapping styles contained in the address for dynamic rendering, loading and display.
[0146] 7. Different users can perform online real-time collaborative editing of various spatial layer elements such as sketching, editing, and rendering on different browser web front-ends.
[0147] 8. After saving, the spatial data edited online can be quickly exported to various data types such as DXF, GDB, Shape, PDF, etc. for local storage or for loading and display on other platforms and applications.
[0148] A system for converting CAD drawings into spatial data and making maps, comprising a file uploading module, a parsing module, a conversion module, a database module, a slicing module and a collaboration module;
[0149] The file upload module is used to receive and store CAD files;
[0150] The parsing module is used to extract layer and element information;
[0151] The conversion module executes multi-threaded tasks and interpolation algorithms to generate spatial data;
[0152] The database module stores spatial data and attribute mapping relationships;
[0153] The slicing module constructs a map tile pyramid and generates a service address;
[0154] The collaboration module supports front-end rendering and multi-user real-time editing.
[0155] In the actual application of this embodiment, the conversion module includes a ring interpolation submodule and an ellipse fitting submodule. The ring interpolation submodule is configured with a default 72 interpolation points to generate a closed ring, and the ellipse fitting submodule calculates the interpolation points based on the major axis, minor axis and deflection angle.
[0156] In practical applications of this embodiment, the slicing module supports dynamic adjustment of tile levels according to user requests to reduce data transmission volume.
[0157] In the actual application of this embodiment, the collaboration module integrates a version control function, records user operation history and supports data backtracking.
[0158] In the practical application of this embodiment, the CAD file supports exporting spatial data in DXF, Shapefile, and PDF formats, and is compatible with GIS and CAD platforms.
[0159] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical principles disclosed herein are intended to be covered by the claims of the present invention.
Claims
1. A method for converting CAD drawings into spatial data and making maps, characterized in that: The following steps are involved: S1: Data upload: upload CAD files to the backend server through the Web terminal and store them, and detect and verify the CAD file coordinate system; S2: Layer catalog parsing and selection configuration, parsing the layer catalog and element information of the CAD file stored in the backend server, and selecting the layer to be converted; S3: Build a multi-threaded conversion task and use algorithms to fit spatial data to graphic elements; S4: Store the converted spatial data into the database and build the attribute field and style mapping relationship; S5: Generates a map tile pyramid based on dynamic slicing technology and publishes the map service address; S6: The front-end calls the service address for rendering, supporting real-time collaborative editing and data export.
2. The method for converting CAD drawings into spatial data and making maps according to claim 1, characterized in that: The algorithm extracts geometric parameters from CAD primitive information and generates discrete interpolation points based on preset interpolation rules, constructing closed or open geometric figures through sequential connection. The algorithm supports customization of interpolation point density to balance accuracy and data volume. The algorithm includes at least one of the following: Ring interpolation algorithm: parses CAD primitive information and generates polygonal fitting by evenly dividing the ring; Elliptical arc interpolation algorithm: parses CAD primitive information and calculates interpolation points based on the major axis, minor axis, and deflection angle; Arc / elliptical arc interpolation algorithm: parses CAD primitive information, divides interpolation points according to arc range, and corrects coordinate offsets based on rotation angle to ensure smooth arcs; Ellipse interpolation algorithm: Analyze CAD primitive information, calculate interpolation points through major axis, minor axis and deflection angle, and achieve accurate fitting of the rotated ellipse; Bezier curve fitting algorithm, which parses CAD primitive information and generates smooth curves based on control point weights; Polyline convex point fitting algorithm: parses CAD polyline elements, distinguishes between straight segments and arc segments, analyzes convex point parameters in segments and fits them independently, and finally merges them into continuous spatial data; Text parsing algorithm: parses CAD text files, parses font outlines into polyline sets, and repairs outline breaks or overlaps through topology detection.
3. The method for converting CAD drawings into spatial data and making maps according to claim 1, characterized in that: The S5's dynamic slicing technology includes real-time generation of multi-level map tiles based on data display accuracy requirements, and optimizing front-end loading efficiency through a pyramid structure.
4. The method for converting CAD drawings into spatial data and making maps according to claim 1, characterized in that: The attribute field construction in step S4 includes automatically mapping the CAD layer style to the spatial data attribute table.
5. The method for converting CAD drawings into spatial data and making maps according to claim 1, characterized in that: The real-time collaborative editing includes multi-user cross-platform synchronous feature drawing, attribute modification and map overlay operations.
6. A system for converting CAD drawings into spatial data and making maps, characterized by: Including file upload module, parsing module, conversion module, database module, slicing module and collaboration module; The file upload module is used to receive and store CAD files; The parsing module is used to extract layer and element information; The conversion module executes multi-threaded tasks and interpolation algorithms to generate spatial data; The database module stores spatial data and attribute mapping relationships; The slicing module constructs a map tile pyramid and generates a service address; The collaboration module supports front-end rendering and multi-user real-time editing.
7. The system for converting CAD drawings into spatial data and making maps according to claim 6, characterized in that: The conversion module includes a ring interpolation submodule and an ellipse fitting submodule. The ring interpolation submodule configures 72 default interpolation points to generate a closed ring, and the ellipse fitting submodule calculates interpolation points based on the major axis, minor axis and deflection angle.
8. The system for converting CAD drawings into spatial data and making maps according to claim 6, characterized in that: The slicing module supports dynamic adjustment of tile levels according to user requests to reduce data transmission volume.
9. The system for converting CAD drawings into spatial data and making maps according to claim 6, characterized in that: The collaboration module integrates version control functions, records user operation history and supports data backtracking.
10. A method or system for converting CAD drawings into spatial data and making maps according to claim 1 or 6, characterized in that: The CAD file supports exporting spatial data in DXF, Shapefile, and PDF formats, and is compatible with GIS and CAD platforms.
Citation Information
Patent Citations
A method for layered display of large-volume CAD files in a web front-end
CN112100123B
Cited By
CAD (Computer Aided Design) drawing watching method and device supporting cross-platform font configuration, equipment and medium
CN120995982A