CN118051556B - DXF file conversion method and device for map engine visual interaction - Google Patents
DXF file conversion method and device for map engine visual interaction Download PDFInfo
- Publication number
- CN118051556B CN118051556B CN202410449257.9A CN202410449257A CN118051556B CN 118051556 B CN118051556 B CN 118051556B CN 202410449257 A CN202410449257 A CN 202410449257A CN 118051556 B CN118051556 B CN 118051556B
- Authority
- CN
- China
- Prior art keywords
- dxf
- dxf file
- primitive
- file
- map engine
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 230000003993 interaction Effects 0.000 title claims abstract description 39
- 238000006243 chemical reaction Methods 0.000 title claims abstract description 33
- 230000000007 visual effect Effects 0.000 title abstract description 32
- 238000012546 transfer Methods 0.000 claims description 16
- 238000012800 visualization Methods 0.000 claims description 10
- 238000003780 insertion Methods 0.000 claims description 7
- 230000037431 insertion Effects 0.000 claims description 7
- 238000000605 extraction Methods 0.000 claims description 4
- 238000010586 diagram Methods 0.000 description 12
- 238000013461 design Methods 0.000 description 11
- 238000009877 rendering Methods 0.000 description 10
- 238000005516 engineering process Methods 0.000 description 7
- 238000004458 analytical method Methods 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 230000002452 interceptive effect Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000011426 transformation method Methods 0.000 description 3
- 238000013459 approach Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 239000003086 colorant Substances 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 1
- 238000013079 data visualisation Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000004069 differentiation Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 238000011835 investigation Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000013439 planning Methods 0.000 description 1
- 238000005070 sampling Methods 0.000 description 1
- 238000001370 static light scattering Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 230000001131 transforming effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
- G06F16/258—Data format conversion from or to a database
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/26—Visual data mining; Browsing structured data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/29—Geographical information databases
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Remote Sensing (AREA)
- Processing Or Creating Images (AREA)
Abstract
The invention relates to the GIS field, in particular to a DXF file conversion method and device for map engine visual interaction. According to the invention, the DXF file is analyzed, and then converted into a KML format file widely supported by a map engine, and then converted into a new DXF file. Therefore, the new DXF file can be perfectly compatible with the map engine on the premise of retaining various style parameters (layer style information, geometric shape and other information) of the original DXF graph, and visual interaction with the map engine is realized.
Description
Technical Field
The invention relates to the GIS field, in particular to a DXF file conversion method and device for map engine visual interaction.
Background
DXF is a CAD file format widely used in AutoCAD software to store information such as geometry, layers, patterns, labels, etc. of graphics in ASCII text files. With the increasing popularity of AutoCAD software, DXF files have become virtually an internationally universal standard for exchanging graphic data, and are widely used for exchanging and sharing graphic data in different fields.
GIS (geographic information system) is a comprehensive computer technology system based on database technology, and inputs, stores, manages, processes, analyzes and outputs geographic data under the support of computer software and hardware. The GIS technology can be widely applied to each stage of planning, investigation, design, construction, operation and maintenance of engineering projects and the like, and realizes data sharing of all participants on the basis of the same multidimensional GIS model in the whole life cycle of the building. With the continuous development and optimization of the GIS technology in the design field and the progress of the map engine technology, the combination of the GIS technology and the map platform has become a novel and valuable research topic in the fields of highway engineering and the like, and the combination of the GIS technology and the map platform has brought about gradual attention and research in the industry.
Compared with CAD data, GIS data has higher rendering efficiency, is simpler, and can be in seamless connection with a global map system and the like. Currently, mainstream map engines such as ArcGIS and SuperMap, etc., despite significant progress in the GIS field, still have the problem of not being able to directly import DXF files for loading and display. This is because GIS data sources are complex and data formats are not uniform, and therefore, ideal levels have not been reached in terms of efficient, interactive map presentation based on DXF files.
Patent CN108710666a proposes a method of achieving target conversion by selecting a plurality of regions in a preset shape and size, and selecting a preset number of target reference points in the regions. The method utilizes the target datum points corresponding to each region to determine a target conversion rule, and finally generates a converted KML file. However, this approach suffers from a number of disadvantages,
The geographic information contained in the DXF file is less, and the graphic display requirement of a user cannot be met;
2. The conversion method of the regular geometric shape is not clear, so that the analysis rule of the geometric shape is not clear;
3. the converted KML file cannot contain layer style information such as font color, font size, line width, line color;
4. the layer names corresponding to the geometric shapes cannot be obtained, and the geometric shapes are difficult to manage according to the layer names;
5, the DXF files have various contents, and can not realize standardized and normalized display when the maps of the mobile terminal and the desktop terminal are displayed;
6. the converted DXF file cannot be checked on the maps of the mobile terminal and the desktop terminal, and a new DXF file cannot be generated by modification according to actual conditions;
7. The converted KML file does not perform map visual interaction, and map locating interaction according to the graph can not be realized;
8. the same DXF file cannot be version managed and compared on a map.
And 9, the DXF file data conversion rule lacks projection coordinate system parameters, and conversion of a mobile terminal and a desktop terminal into KML files cannot be realized.
Thus, there is a need for a DXF file transformation method that includes geographic information and layer style information, has clearer geometric resolution, and is capable of visual interaction with a map engine.
Disclosure of Invention
The invention aims to overcome the defects in the prior art and provide a DXF file conversion method for map engine visual interaction.
In order to achieve the above object, the present invention provides the following technical solutions:
a DXF file conversion method for map engine visualization interactions, comprising the steps of:
S1: obtaining a DXF file to be converted;
s2: extracting data information of the DXF file and converting the data information into a standard KML file;
S3: loading the standard KML file into a map engine for display;
S4: the map engine exports a converted DXF file;
wherein, the step S2 comprises the following steps:
S21: searching a start mark of the DXF file to be used as a start mark for extracting data information;
s22: extracting group code information corresponding to variable content in a HEADER field; the variable content comprises CAD version, drawing setting, layer control, block control, line control and/or color control;
s23: extracting group code information corresponding to the form data in TABLES fields; the table data comprises a linear table, a layer table and/or a view port table;
S24: extracting graphic object data in an Entities field, and converting the graphic object data and corresponding attribute information thereof into PLACEMARK elements in a KML file; the graphic object data comprises circles, ellipses, points, straight lines, multi-section lines and/or characters;
S25: when the EOF mark is extracted, ending the extraction of the data information of the current DXF file; and generating a standard KML file according to PLACEMARK elements generated by conversion.
As a preferred embodiment of the present invention, the line type table in S23 is used to store names, identifiers, text strings, numbers of elements within a line type, and scale values of all line types.
As a preferred embodiment of the present invention, the layer table in S23 is used to store names, identifiers and color numbers of all layers.
As a preferred embodiment of the present invention, the viewport table in S23 is configured to store names, center coordinates, heights and widths of all viewports.
As a preferred embodiment of the present invention, the step S24 includes the steps of:
S241: reading the primitive information;
s242: extracting a primitive handle;
s243: extracting a layer name;
S244: extracting corresponding primitive parameters according to the primitive types;
s245: and converting the graphic object data and the corresponding attribute information thereof into PLACEMARK elements in the KML file.
As a preferred embodiment of the present invention, when the primitive type is a circle, the primitive parameters thereof are the center point coordinates and the radius.
As a preferable scheme of the invention, when the primitive type is elliptical, the primitive parameters are the central point coordinate, the ratio value of the short axis to the long axis, the starting point and the end point parameters.
As a preferred scheme of the invention, when the primitive type is a point, a straight line or a multi-segment line, the primitive parameters are all endpoint coordinates and primitive color numbers.
As a preferable scheme of the invention, when the primitive type is text, the primitive parameters are the coordinates of the insertion point, the text height, the primitive color number and the graphic direction.
A DXF file transfer device for map engine visualization interactions, comprising at least one processor, and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the preceding claims.
Compared with the prior art, the invention has the beneficial effects that:
according to the invention, the DXF file is analyzed, and then converted into a KML format file widely supported by a map engine, and then converted into a new DXF file. DXF is converted with KML files, which are CAD data file formats, and KML is a map data format widely used by geographic information systems such as Google Earth. The method creatively converts DXF file data into KML files, so that design files with complex data structures such as CAD drawings and the like, including shapes, positions, notes and the like, can be expressed in a map engine, and fusion of two different field data using modes is realized. And then exporting the converted content in the form of a DXF file, so that the source format of the file is maintained, and the subsequent use is convenient. In this way, interactive editing of the CAD design by the map engine is achieved. Therefore, the new DXF file can be perfectly compatible with the map engine on the premise of retaining various style parameters (layer style information, geometric shape and other information) of the original DXF graph, and visual interaction with the map engine is realized.
Drawings
FIG. 1 is a flow chart of a DXF file conversion method for map engine visual interaction according to embodiment 1 of the present invention;
FIG. 2 is a flow chart of a method for converting DXF files for visual interaction of a map engine according to embodiment 2 of the present invention;
fig. 3 is a schematic diagram of a circle correspondence conversion PLACEMARK element in a DXF file conversion method for map engine visual interaction according to embodiment 2 of the present invention;
fig. 4 is a schematic diagram of elements corresponding to conversion PLACEMARK in a DXF file conversion method for map engine visual interaction according to embodiment 2 of the present invention;
FIG. 5 is a diagram illustrating elements of a line-to-line conversion PLACEMARK in a DXF file conversion method for map engine visual interaction according to example 2 of the present invention;
Fig. 6 is a schematic diagram of a multi-segment line corresponding conversion PLACEMARK element in a DXF file conversion method for map engine visual interaction according to embodiment 2 of the present invention;
FIG. 7 is a diagram illustrating a multiple-line text correspondence conversion PLACEMARK element in a DXF file conversion method for map engine visual interaction according to embodiment 2 of the present invention;
fig. 8 is a schematic diagram of a custom projection coordinate transformation flow in a DXF file transformation method for map engine visual interaction according to embodiment 2 of the present invention;
FIG. 9 is a diagram of DXF original data content in a DXF file conversion method for map engine visual interaction according to embodiment 2 of the present invention;
Fig. 10 is a schematic diagram of KML data content in a DXF file transfer method for map engine visual interaction according to embodiment 2 of the present invention;
FIG. 11 is a schematic diagram illustrating editing of a DXF graphic object in a DXF file conversion method for map engine visual interaction according to embodiment 2 of the present invention;
FIG. 12 is a schematic diagram of a map engine comparing different versions of DXF files in the method for transforming DXF files for visual interaction of the map engine according to embodiment 2 of the present invention;
fig. 13 is a schematic diagram of a DXF file transformed by a mobile terminal in a DXF file transformation method for map engine visual interaction according to embodiment 2 of the present invention;
Fig. 14 is a schematic structural diagram of a DXF file transfer device for map engine visual interaction using a DXF file transfer method for map engine visual interaction of embodiment 1 according to embodiment 3 of the present invention.
Detailed Description
The present invention will be described in further detail with reference to test examples and specific embodiments. It should not be construed that the scope of the above subject matter of the present invention is limited to the following embodiments, and all techniques realized based on the present invention are within the scope of the present invention.
Example 1
As shown in fig. 1, a DXF file conversion method for map engine visualization interactions includes the steps of:
S1: and obtaining the DXF file to be converted.
S2: and extracting the data information of the DXF file, and converting the data information into a standard KML file.
S3: and loading the standard KML file into a map engine for display.
S4: the map engine exports the converted DXF file.
Wherein, the step S2 comprises the following steps:
S21: and searching a start mark of the DXF file to be used as a start mark for extracting data information.
S22: extracting group code information corresponding to variable content in a HEADER field; the variable content includes CAD versions, drawing settings, layer controls, block controls, line controls, and/or color controls.
S23: extracting group code information corresponding to the form data in TABLES fields; the table data includes a line table, a layer table, and/or a viewport table.
S24: extracting graphic object data in an Entities field, and converting the graphic object data and corresponding attribute information thereof into PLACEMARK elements in a KML file; the graphical object data includes circles, ellipses, points, lines, multi-segment lines, and/or text.
S25: when the EOF mark is extracted, ending the extraction of the data information of the current DXF file; and generating a standard KML file according to PLACEMARK elements generated by conversion.
Example 2
The embodiment is a specific implementation manner of a DXF file conversion method for map engine visual interaction according to embodiment 1, as shown in fig. 2, including the following steps:
S1: and obtaining the DXF file to be converted.
S2: and extracting the data information of the DXF file, and converting the data information into a standard KML file.
S21: and searching a start mark of the DXF file to be used as a start mark for extracting data information.
I.e., read from the start tag SECTION of the DXF file, the HEADER field, TABLES field, BLOCKS field, entitis field are read in sequence until EOF indicates the end of the file.
S22: extracting group code information corresponding to variable content in a HEADER field; the variable content includes CAD versions, drawing settings, layer controls, block controls, line controls, and/or color controls.
In the HEADER field, the variable content therein is parsed, including but not limited to CAD versions, drawing settings, layer controls, block controls, line controls, color controls, and the like.
Where $ ACADVER represents the AutuoCAD version adopted by the current DXF file, which corresponds to group code 1, the version specified by acadver to parse the file, such as: autoCAD graphic database version number:
AC1006 = R10;
AC1009 = R11 and R12;
AC1012 = R13;
AC1014 = R14;
AC1015 = AutoCAD 2000;
AC1018 = AutoCAD 2004;
AC1021 = AutoCAD 2007;
AC1024 = AutoCAD 2010。
Where $ INSUNITS represents the insertion unit used in the DXF file. This is important meta-information, as it determines the way in which the measured values of all graphical elements are interpreted. Its corresponding group code is 70, where the value corresponds to a unit.
Such as:
0 = no units; 1 = inch; 2 = feet; 3 = miles; 4 = millimeters;
5 = cm; 6 = meters; 7=km; 8 = microinches;
9 = mil; 10 Code; 11 =angstroms; 12 =nm;
13 =micrometers; 14 =decimeter; 15 =ten meters;
16 =hundred meters; 17 =million kilometers; 18 =astronomical unit;
19 =light year; 20 Difference in seconds
The definition HEADERDIC object is used to store the post-HEADER field parsed results.
{
"Version": "AC1024",// AutuoCAD Version
"Unit": 6// all graphic element units
}
S23: extracting group code information corresponding to the form data in TABLES fields; the tabular data includes a Line (LTYPE) table, a LAYER (LAYER) table, and/or a Viewport (VPORT) table.
The view LookAt object defining the KML camera is used to store parsed view port parameters to define an initialized view of a map or scene.
LTYPE table (line table), LTYPE table defines all available lines in the graph, which stores names, identifiers, text strings, number of elements within a line, and scale values for all lines. Some of the primary group code information below includes:
2: the name of the line type.
70: A linear identifier.
3: Text strings describing a linear pattern.
73: An integer number of elements in the line is defined.
49: The value of a dash, space, or text in absolute unit length or scale mode.
The DESIGNDATA array is defined to store LTYPE table (linear table) analysis to obtain design information.
[{
"LineName": "SuiDao _ XUXIAN",// name of the line type
"LINEMARKER": 0// identifier of line type
Desc identifier of "Solid line"// line type
"ElementsCount": 2// defines an integer defining the number of elements in the line
"Mode" 1.0// in absolute unit length or scale mode
}]
A LAYER table (LAYER table) defines all available LAYERs in the graph, which stores names, identifiers, and color numbers of all LAYERs. Specifically, the primary group code information includes:
2: the name of the layer.
70: An identifier of the layer.
62: Color number, if negative, indicates that the layer is closed.
6: Line type name.
Wherein, the color number, if negative, visible takes false, otherwise true. Searching a corresponding decimal color value according to CAD color codes, and converting the decimal color value into a Hex color value, wherein the CAD color codes are exemplified as follows:
{
0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,
10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,
8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464
}
The RENDERSTYLE array is defined to store rendering style information after parsing the LAYER table.
[{
"LAYERNAME": "bridge"// name of layer
Identifier of "LAYERMARKER": 0// layer
"Color": "Hex Color value"// Color value
"Visible": true// layer closed state
}]
The VPORT table (viewport table) defines the viewport arrangement in the workspace, each viewport having an associated name, which stores the names, center coordinates, height and width of all the viewports. Specifically, the primary group code information includes:
2: name of viewport
10: The X coordinate of the lower left corner of the viewport.
20: Y coordinate of the lower left corner of the viewport.
11: The X coordinate of the upper right corner of the viewport.
21: Y coordinate of the upper right corner of the viewport.
The view port information obtained from the VPORT table includes a center point (calculated from the coordinates of the lower left and upper right corners of the view port), as well as a height and width. Using the proj4 library, the point (X, Y) coordinates and custom projection coordinate parameters are converted to WGS84 latitude and longitude (longitude ) coordinates, using longitude (longitude) and latitude (latitude) in element LookAt to represent the viewport center point. The 2D coordinates of the AutoCAD workspace need to be converted to geographic coordinates, which may require known geographic references or additional coordinate mapping data. Range in LookAt elements is used to represent the distance of the observation point from the ground. This distance may be determined by the height/width in VPORT or other suitable scale. While tilt=0 and head=0 may be set by default to define the top view and north orientation.
The LookAt elements in an example KML file may be as follows:
<LookAt>
< longitude > longitude of viewport center point </longitude >
< Latitude > latitude of viewport center point
<altitude>0</altitude>
< Range > distance of range > observation point from ground
<tilt>0</tilt>
<heading>0</heading>
<altitudeMode>relativeToGround</altitudeMode>
</LookAt>
S24: extracting graphic object data in an Entities field, and converting the graphic object data and corresponding attribute information thereof into PLACEMARK elements in a KML file; the graphical object data includes circles, ellipses, points, lines, multi-segment lines, and/or text, etc.
S241: reading the primitive information;
s242: extracting a primitive handle;
s243: extracting a layer name;
S244: extracting corresponding primitive parameters according to the primitive types;
when the primitive type is a circle, the primitive parameters thereof are the center point coordinates and the radius.
Wherein the CIRCLE (CIRCLE), the CIRCLE in DXF is represented by a center point and a radius, corresponding to some of the primary group code information and DXF definitions include:
0: the start of a circular primitive (CIRCLE). 5: handle marks. 330: soft pointer ID/handle. 100: subclass labels (AcDbEntity). 67: the absence or 0 indicates that the graphical element is located in model space. 1: the representation elements are located in drawing space. 8: layer name. 100: subclass labels (AcDbCircle). 10: center point X value. 20: center point Y value. 30: center point Z value. 40: radius.
According to the primitive Unit obtained in S22, converting the circle radius Unit into m (meters), adopting proj4 library, converting the coordinates of point (X, Y) and the custom projection coordinate parameters into the coordinates of longitude and latitude (longitude ) of WGS84, obtaining the rendering pattern from RENDERSTYLE by the layer name, including line color and line width, converting into Polygon in KML, and giving LINEARRING a set of coordinates in Polygon to generate the path of the circle. This path may generally be generated by setting the number of points on the arc, sampling in equal intervals, calculating the coordinate points on the arc, and generating a series of coordinates. Its corresponding PLACEMARK elements in KML are shown in fig. 3.
Oval (ELLIPSE), resembling a circle. When the primitive type is elliptical, the primitive parameters are the central point coordinates, the ratio of the short axis to the long axis, the starting point and the end point.
When the primitive type is a point, a straight line or a multi-segment line, the primitive parameters are all endpoint coordinates and primitive color numbers.
Wherein POINT (POINT), CIRCLE in DXF is represented by a center POINT and radius, corresponding to some of the primary group code information and corresponding DXF definitions include:
0: start of dot element (POINT). 5: handle marks. 100: subclass labels (AcDbEntity). 8: layer name. 100: subclass labels (AcDbPoint). 10: center point X value. 20: center point Y value. 30: center point Z value. The group codes 10 20 30 of the POINT elements are sequentially used for representing X, Y, Z coordinates of the POINTs, a proj4 library is adopted, the coordinates of the POINTs (X, Y) and the custom projection coordinate parameters are converted into the coordinates of the longitude and latitude (longitude ) of the WGS84, and a rendering style comprising text color, text size scale, icon color and icon size scale of the POINTs is obtained from RENDERSTYLE through the layer names, and PLACEMARK elements corresponding to the POINTs in the KML are shown in fig. 4.
Wherein, the LINE (LINE) in DXF is represented by a LINE segment defined by two points, and the corresponding main group code information and DXF definition include:
0: the start of a straight LINE primitive (LINE). 5: handle marks. 100: subclass labels (AcDbEntity). 8: layer name. 10: the X value of the starting point. 20: y value of starting point. 30: z value of the starting point. 11: the X value of the endpoint. 21: the Y value of the endpoint. 31: z value of the endpoint. 62: primitive color number.
LINE correspondence DXF definition as shown in fig. 7, group codes "10", "20", and "30" of LINE elements represent the x, y, z coordinates of the start of the LINE, respectively, while group codes "11", "21", and "31" represent the x, y, z coordinates of the end of the LINE. And converting the coordinates of the points (x and y) and the custom projection coordinate parameters into the longitude and latitude of WGS84 by adopting a proj4 library, and obtaining a rendering style comprising color and line width of a line from RENDERSTYLE by using a layer name, wherein the corresponding PLACEMARK elements are shown in KML (KML), as shown in fig. 5.
Wherein the optimized multi-segment line (LWPOLYLINE), LWPOLYLINE in DXF is represented by a continuous segment of vertices, which may be straight or arcuate, corresponding to a number of primary group code information and DXF definitions including:
0: the start of the multi-segment line primitive is optimized (LWPOLYLINE). 5: handle marks. 8: layer name. 10: the X value of the vertex coordinates. 20: y value of vertex coordinates. 70: a multi-segment line mark. 62: primitive color number.
Wherein the multi-segment line (POLYLINE) is similar to the optimized multi-segment line. The group codes "10" and "20" of LWPOLYLINE elements define the X and Y coordinates of each vertex of the polyline segment, "70" representing the morphology of the polyline, where 0 represents not closed and 1 represents closed. And converting the coordinates of the points (X, Y) and the custom projection coordinate parameters into the longitude and latitude of WGS84 by adopting a proj4 library, and obtaining a rendering style from RENDERSTYLE by using the layer name, wherein the rendering style comprises color and line width of a line, and corresponding PLACEMARK elements in KML (KML), as shown in fig. 6.
When the primitive type is text, the primitive parameters are the coordinates of the insertion point, the text height, the primitive color number and the graphic direction.
Wherein the MTEXT elements in the DXF file represent lines of text (MTEXT) that are typically used for notes or tags, corresponding to some of the primary group code information and DXF definitions including:
0: the start of a multi-line literal primitive (MTEXT). 5: handle marks. 8: layer name. 10: the X value of the insertion point. 20: the Y value of the insertion point. 30: the Z value of the insertion point. 40: the text is high. 1: a character string. 7: literal style name. 62: primitive color number. 72: the direction of the pattern.
Multiple lines of text corresponding DXF definitions as shown in fig. 11, the group codes "10", "20", "30" of MTEXT elements represent X, Y, Z values of text coordinates, respectively, "40" represents text height, "1" represents actual text content, and "7" refers to style. And converting the coordinates of the points (X, Y) and the custom projection coordinate parameters into the longitude and latitude of the WGS84 by adopting a proj4 library, and obtaining a rendering style comprising the color of the text and the size scale of the text from RENDERSTYLE through the layer name. Its corresponding PLACEMARK elements in KML are shown in fig. 7. And TEXT (TEXT) is extracted, similar to a plurality of lines of TEXT.
The process of converting the custom projection coordinates in the above process is shown in fig. 8, and parameters of the custom projection coordinates are as follows:
PR0JCS["ZYGS-HC-2108",GEOGCS["GCS_WGS_1984",DATUM["D_WGS84",SPHEROID["WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["scale_factor",0.999961178999999],PARAMETER["Central_meridian",105.170223273361],PARAMETER["latitude_of_origin",0],PARAMETER["false_easting",500346.949685133],PARAMETER["false_northing",276.568758283742],UNIT["Meter",11]
s245: and converting the graphic object data and the corresponding attribute information thereof into PLACEMARK elements in the KML file.
S25: when the EOF mark is extracted, ending the extraction of the data information of the current DXF file; and generating a standard KML file according to PLACEMARK elements generated by conversion.
For example, parsing of DXF original data content (as shown in fig. 9) is converted into corresponding KML data content (as shown in fig. 10), the generated data is parsed by the graphics object, and finally a standard KML file is generated. As can be seen from the foregoing description, the meanings corresponding to the group code numbers in fig. 9 are: 8 layer names; 100 subclass labels (AcDbLine); 90 top points; 70 a multi-segment line mark; an X value of 10 origin; a Y value of 20 origin; 40 start point width; 41 end point width.
Specifically, the value DLSS of the group code 8 in fig. 9 corresponds to the < name > layer name tag in fig. 10 after parsing; the values AcDbPolyline of the set of codes 100 of fig. 9, after parsing, correspond to the < LINESTRING > line element labels in fig. 10; the values of the vertex coordinates of the set of codes 10, 20 of fig. 9, after parsing, correspond to the < coordinates > geometry labels in fig. 10.
The invention analyzes the DXF file downloaded to the terminal and converts the DXF file into a KML format file widely supported by a map engine. The method extracts the data in the DXF file, and then converts the data into a KML file format acceptable by the map engine, thereby realizing the data visualization of the map engine. This innovative approach preserves various style parameters of the original DXF graphic, including font size, font color, line width, line color, line transparency, and visibility status, among others. The map engine can accurately render various graphic data such as circles, ellipses, points, straight lines, multi-line segments, characters and the like according to the rendering patterns set in the KML file, so that the original DXF file is restored to a high degree, and meanwhile, the visual mode can conveniently display geographic information to a user, and the understandability and operability of the data are improved.
S3: and loading the standard KML file into a map engine for display.
According to the invention, the DXF text format file is converted into the KML data which can be identified by the geographic engine, and the data comprises design data and rendering patterns, so that the operation that the DXF file is firstly transmitted to a server and then the DXF file data is issued to vector map service in the prior art is omitted, and the problems that the map service is not issued in time and the map service cannot be accessed in time after being issued successfully due to network reasons are avoided. Meanwhile, the requirement of opening the map engine to load the DXF file in the field network-free environment of the mobile terminal is also met.
S4: the map engine exports the converted DXF file.
As shown in FIG. 11, the standard KML file can also edit graphic object attributes and styles after being loaded into a map engine, so that the DXF file converted and output more meets the requirements of staff.
Further, as shown in fig. 12, the method of the present application can simultaneously display DXF files of different versions in the map engine, simultaneously display DXF files of two different moments on the map engine, and identify them with different colors or different lines, so that the scheme designer can clearly know which parts are modified and which parts are not modified. The drawing skill can greatly improve the working efficiency and reduce misunderstanding and confusion caused by unclear modification conditions. The beneficial effects are that:
1) Time version comparison: different versions of design schemes can be displayed, and through comparison, a designer can clearly see the changes among the different versions, so that the design scheme is more visual and clear.
2) Color differentiation: different colors are used for distinguishing different versions from unmodified parts, so that understanding and comparison are simpler and clearer, and the working efficiency is greatly improved.
3) Visual interactive editing: the scheme designer can directly modify the design on the map engine and then export the design into a new DXF file, so that the function increases the flexibility of work and the operation is more convenient and quicker.
And as shown in fig. 13, the converted DXF file may also be loaded through the mobile end. Implementing data conversion and map visualization of such DXF files on a mobile end provides greater convenience and flexibility. The user can acquire and operate the file at any time and any place without being limited by time and place. (most similar conversion or display operations are conventionally performed at the computer end. For mobile end implementation of this method, the operation sites of users are widened, so that data processing and design work can be performed at any time and any place without any obstacle).
The invention solves the problems that in the prior art, DXF files are text files and a map engine cannot be imported for display based on a visual interaction method involving the files and the map engine. The communication efficiency of each participant of the engineering project is improved, and errors and risks in the project construction process are reduced. Through the method, the user can intuitively view and edit the attribute and the style of the graphic object in the DXF file on the map, thereby realizing more efficient collaboration and information sharing and achieving the following effects:
1. Geographic information integrity: the invention reserves the geographic information in the original DXF file in the visual interaction through the comprehensive map engine, thereby meeting the requirement of users on graphic display.
2. Geometry parsing rules: by analyzing the DXF file at the terminal, the analysis rule of the geometric shape is defined, so that the map engine can display various graphic data more accurately.
3. Layer style information: the invention includes the layer style information in the KML file, ensures that the converted file can accurately reflect the style of the original graph.
4. Map visualization interactions: visual interaction of the map engine is introduced, and the visual interaction comprises editing, searching, positioning and other functions of the graphic objects, so that user experience is improved.
5. Terminal processing and user operation: the invention completes the analysis and conversion of the DXF file at the terminal, simultaneously provides the user-friendly editing and exporting functions, and increases the flexibility.
Example 3
As shown in fig. 14, a DXF file transfer device for map engine visualization interactions includes at least one processor, and a memory communicatively coupled to the at least one processor, and at least one input-output interface communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a DXF file transfer method for map engine visualization interactions as described in the previous embodiments. The input/output interface may include a display, a keyboard, a mouse, and a USB interface for inputting and outputting data.
Those skilled in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware related to program instructions, and the foregoing program may be stored in a computer readable storage medium, where the program, when executed, performs steps including the above method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read Only Memory (ROM), a magnetic disk or an optical disk, or the like, which can store program codes.
The above-described integrated units of the invention, when implemented in the form of software functional units and sold or used as stand-alone products, may also be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present invention may be embodied in essence or a part contributing to the prior art in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a removable storage device, a ROM, a magnetic disk, or an optical disk.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, and alternatives falling within the spirit and principles of the invention.
Claims (10)
1. A DXF file transfer method for map engine visualization interactions, comprising:
S1: obtaining a DXF file to be converted;
s2: extracting data information of the DXF file and converting the data information into a standard KML file;
S3: loading the standard KML file into a map engine for display;
S4: the map engine exports a converted DXF file;
wherein, the step S2 comprises the following steps:
S21: searching a start mark of the DXF file to be used as a start mark for extracting data information;
s22: extracting group code information corresponding to variable content in a HEADER field; the variable content comprises CAD version, drawing setting, layer control, block control, line control and/or color control;
s23: extracting group code information corresponding to the form data in TABLES fields; the table data comprises a linear table, a layer table and/or a view port table;
S24: extracting graphic object data in an Entities field, and converting the graphic object data and corresponding attribute information thereof into PLACEMARK elements in a KML file; the graphic object data comprises circles, ellipses, points, straight lines, multi-section lines and/or characters;
S25: when the EOF mark is extracted, ending the extraction of the data information of the current DXF file; and generating a standard KML file according to PLACEMARK elements generated by conversion.
2. The DXF file transfer method of claim 1, wherein the linetype table of S23 is operable to store names, identifiers, text strings, numbers of elements within the linetype, and scale values for all linetypes.
3. The DXF file transfer method of claim 1, wherein the layer table of S23 is configured to store names, identifiers, and color numbers of all layers.
4. The DXF file transfer method of claim 1, wherein the view port table in S23 is configured to store names, center coordinates, heights, and widths of all view ports.
5. The DXF file transfer method for map engine visualization interactions of claim 1, wherein S24 comprises:
S241: reading the primitive information;
s242: extracting a primitive handle;
s243: extracting a layer name;
S244: extracting corresponding primitive parameters according to the primitive types;
s245: and converting the graphic object data and the corresponding attribute information thereof into PLACEMARK elements in the KML file.
6. The DXF file transfer method of claim 5, wherein the primitive parameters are center point coordinates and radii when the primitive type is a circle.
7. The DXF file transfer method of claim 5, wherein when the primitive type is elliptical, the primitive parameters are center point coordinates, short axis to long axis ratio values, start and end point parameters.
8. The DXF file transfer method of claim 5, wherein when the primitive type is a point, a line, or a multi-segment line, the primitive parameters are all endpoint coordinates and primitive color numbers.
9. The DXF file transfer method of claim 5, wherein, when the primitive type is text, the primitive parameters are insertion point coordinates, text height, primitive color number, and graphics orientation.
10. A DXF file transfer device for map engine visualization interactions, comprising at least one processor, and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410449257.9A CN118051556B (en) | 2024-04-15 | 2024-04-15 | DXF file conversion method and device for map engine visual interaction |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410449257.9A CN118051556B (en) | 2024-04-15 | 2024-04-15 | DXF file conversion method and device for map engine visual interaction |
Publications (2)
Publication Number | Publication Date |
---|---|
CN118051556A CN118051556A (en) | 2024-05-17 |
CN118051556B true CN118051556B (en) | 2024-06-07 |
Family
ID=91046990
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410449257.9A Active CN118051556B (en) | 2024-04-15 | 2024-04-15 | DXF file conversion method and device for map engine visual interaction |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118051556B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101630335A (en) * | 2008-07-18 | 2010-01-20 | 纬衡浩建科技(深圳)有限公司 | Method for comparing similarity and difference between drawings |
CN105512235A (en) * | 2015-11-30 | 2016-04-20 | 中国地质大学(武汉) | GIS and AutoCAD data exchange method and intermediate file |
CN106569760A (en) * | 2016-04-23 | 2017-04-19 | 上海大学 | Large-scale GIS display system based on synchronous control, and display method of large-scale GIS display system |
CN110516383A (en) * | 2019-08-30 | 2019-11-29 | 兰州深蓝图形技术有限公司 | A kind of parsing of railway signals equipment vector graphics file, display methods and device |
CN117454476A (en) * | 2023-10-18 | 2024-01-26 | 中铁第一勘察设计院集团有限公司 | Method and system for generating construction organization plane layout schematic diagram based on satellite map |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8788496B2 (en) * | 2009-09-30 | 2014-07-22 | Trimble Navigation Limited | Visual organization of information via associated geospatial data |
-
2024
- 2024-04-15 CN CN202410449257.9A patent/CN118051556B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101630335A (en) * | 2008-07-18 | 2010-01-20 | 纬衡浩建科技(深圳)有限公司 | Method for comparing similarity and difference between drawings |
CN105512235A (en) * | 2015-11-30 | 2016-04-20 | 中国地质大学(武汉) | GIS and AutoCAD data exchange method and intermediate file |
CN106569760A (en) * | 2016-04-23 | 2017-04-19 | 上海大学 | Large-scale GIS display system based on synchronous control, and display method of large-scale GIS display system |
CN110516383A (en) * | 2019-08-30 | 2019-11-29 | 兰州深蓝图形技术有限公司 | A kind of parsing of railway signals equipment vector graphics file, display methods and device |
CN117454476A (en) * | 2023-10-18 | 2024-01-26 | 中铁第一勘察设计院集团有限公司 | Method and system for generating construction organization plane layout schematic diagram based on satellite map |
Non-Patent Citations (4)
Title |
---|
AutoCAD文件转换为KML文件的方法对比;罗丹 等;《湖南水利水电》;20220531;89-91 * |
Google earth and XML: advanced visualization and publishing of geographic information;E Stefanakis et al.;《Lecture Notes in Geoinformation and Cartography》;20081231;143–152 * |
基于BIM+GIS技术的河床演变分析;金瑞 等;《水运工程》;20210630;206-244 * |
基于GIS铁路选线CAD系统的研究与应用;王一波;《中国优秀硕士学位论文全文数据库 基础科学辑》;20120515;A008-87 * |
Also Published As
Publication number | Publication date |
---|---|
CN118051556A (en) | 2024-05-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5214757A (en) | Interactive automated mapping system | |
CN108022273B (en) | Picture number detachable picture making method | |
CN113157665B (en) | Intelligent all-in-one geographic information system | |
CN110516015B (en) | Method for manufacturing geographical PDF map based on map graphic data and DLG | |
CN110851118A (en) | Vector icon drawing method and device for three-dimensional scene | |
CN113569308B (en) | 3DE platform-based safety monitoring forward three-dimensional design symbolized graphic method | |
CN115080682A (en) | Method for quickly converting space database to railway CAD digital topographic map full elements | |
Liu et al. | Atlas: Grammar-based procedural generation of data visualizations | |
CN118051556B (en) | DXF file conversion method and device for map engine visual interaction | |
Visvalingam | Trends and concerns in digital cartography | |
KR20010037981A (en) | Method for converting map data to data for object_related geographic information system | |
CN113535879B (en) | Map data processing method and device for administrative region | |
Hardy | Multi-scale database generalisation for topographic mapping, hydrography and web-mapping, using active object techniques | |
Kopylova et al. | The functionality analysis of the quantum GIS Geo-information system as a part of the small-scale maps creation | |
Yonov et al. | 3D maps–Cartographical aspects | |
II | A Cartographic data model for Better Geographical Visualization based on Knowledge | |
CN118332037A (en) | Method and system for lossless conversion of CAD (computer aided design) geographic data and SHP (short-time period) data | |
CN116610741A (en) | Pipeline data entry and visualization system | |
Krivoruchko et al. | Map-Studio: The specialized GIS integrating possibilities of geostatistics | |
Lei et al. | System development of making an image map based on google earth | |
CN116702276A (en) | Bridge multifunctional control element construction method based on GIS system | |
Hardy et al. | Database-stored representations and overrides, supporting automated cartography with human creativity | |
de Kock et al. | Towards AN Open Source Python Library for Automated Exploratory Spatial Data Analysis | |
Zhao et al. | A Database-based Automatic Cartography Method | |
Aybet | Interoperability of GIS in an open system environment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant |