Topographic map-to-DEM method based on inverse distance weighting method

By using the inverse distance weight method to fit the elevation data with RMSPE during the topographic map to DEM process, the problem of insufficient accuracy of topographic map to DEM in the prior art is solved, and higher fitting accuracy and more accurate construction guidance are achieved.

CN119942012APending Publication Date: 2025-05-06CCCC SHANGHAI DREDGING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510003097.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-02
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

When converting topographic maps into digital elevation models (DEMs), the prior art has problems such as insufficient accuracy or lack of key points, resulting in insufficient construction guidance and high cost of repeated surveying and mapping.

Method used

The topographic map to DEM method based on the inverse distance weight method is used to fit the elevation data through the inverse distance weight method and the root mean square percentage error (RMSPE) to improve the fitting accuracy.

Benefits of technology

It improves the accuracy of topographic map to DEM, solves the problems of insufficient data accuracy or lack of key points, can guide construction more accurately, and reduces the cost of repeated surveying and mapping.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119942012A_ABST
    Figure CN119942012A_ABST
Patent Text Reader

Abstract

The invention discloses a topographic map-to-DEM method based on an inverse distance weighting method, which comprises the following steps: S1, analyzing a topographic map CAD file in a dxf format, extracting polylines, line segments and point data in the topographic map CAD file, and converting the polylines, line segments and point data into point data expressed by (x, y, z); s2, performing grid division on a range in which data precision needs to be improved; s3, calculating a fitting value by using an inverse distance weight method; s4, selecting a plurality of known points, calculating an error by using RMSPE, and selecting a point number n required to be used for fitting under the condition that an error result is minimum; and S5, calculating all the remaining grid points by using n to obtain a DEM model. According to the method, the inverse distance weighting method and the root mean square percentage error are used for fitting the elevation data, and the fitting precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method for converting a topographic map into a DEM based on an inverse distance weighting method. Background Art

[0002] Digital Elevation Model (DEM) is a method of digitally simulating the ground terrain through limited terrain elevation data. In essence, it is a digital array information model (x, y, z). Domestic construction units often use the regular grid model in DEM to obtain the elevation data required for construction. However, the terrain elevation data provided by the owners or design units of some projects are not accurate enough or lack key points. At the same time, the cost of repeated surveying is high. Therefore, it is necessary to fit the terrain data through algorithms, supplement the missing key points or increase the density of terrain data, so as to obtain a usable DEM.

[0003] At present, the common fitting methods on the market include CAD (computer-aided design) average value fitting and interpolation fitting, both of which have low accuracy. GIS (geographic information system) software ArcGIS (map drawing software) has built-in multiple complex algorithms to fit elevation. The software focuses on fitting efficiency and ignores the calculation of fitting loss, which affects the accuracy of the final DEM.

[0004] Therefore, a method for converting topographic map to DEM based on inverse distance weighted method is provided. Summary of the invention

[0005] The purpose of the present invention is to overcome the existing defects and provide a topographic map to DEM method based on inverse distance weighting method, which uses inverse distance weighting method and root mean square percentage error to fit elevation data and improve fitting accuracy.

[0006] The technical solution to achieve the above purpose is:

[0007] A method for converting a topographic map to a DEM based on an inverse distance weighted method, comprising:

[0008] Step S1, parsing the dxf format topographic map CAD file, extracting the polyline, line segment and point data therein, and converting them into point data expressed by (x, y, z);

[0009] Step S2, gridding the range where data accuracy needs to be improved;

[0010] Step S3, using the inverse distance weighted method to calculate the fitting value;

[0011] Step S4, select several known points to calculate the error using RMSPE (root mean square percentage error), and select the number of points n required for fitting when the error result is the smallest;

[0012] Step S5, using n to calculate all remaining grid points to obtain a DEM model.

[0013] Preferably, in step S1, the CAD file of the topographic map in dxf format is parsed according to the following rules:

[0014] Polyline LWPOLYLINE: Get the coordinate points of each polyline and their corresponding heights, expressed as (x, y, z);

[0015] Line segment Line: Get the starting point and end point of each line, expressed as Start(x,y,z), End(x,y,z);

[0016] Point: Get the coordinates of each point, expressed as (x, y, z).

[0017] Preferably, in step S1, the polyline, line segment and point data represent the terrain, and are finally decomposed into one or more three-dimensional points (x, y, z), where (x, y) represents the plane position of the point and z represents the height of the point; the goal of terrain fitting is to calculate a certain unknown point (x) through these known points in CAD. ij ,y ij )'s height z ij .

[0018] Preferably, in step S2, for an area with CAD data, the maximum and minimum values ​​of x and y of all points in the area are obtained to obtain x min ,x max ,y min ,y max Four values, these four values ​​are combined to obtain the poles in the four directions of the area to be drawn, that is, the upper left corner A (x min ,y max ), upper right corner B(x max ,y max ), lower left corner C(x min ,y min ), lower right corner D(x max ,y min ), the area surrounded by these four points is the area where terrain fitting is required;

[0019] Then, the density of the fitting data is defined, and the step size Step parameter is used to determine the fitting grid density. The two lines AB and AC are divided equally according to the step size, and the intersection point is connected to each other and recorded as a ij , i represents the number of columns, j represents the number of rows, and a ij The coordinates are marked as (x ij ,y ij ), the fitting target is based on aij The z values ​​of the surrounding known points are used to calculate a ij The z value of .

[0020] Preferably, in step S3, an inverse distance weighting method is used to ij The z value is fitted, and the formula is as follows:

[0021]

[0022] In the formula, z represents a ij The height, w i Representative point k i Corresponding height z i The influence weight on z; w i The calculation method is as follows:

[0023]

[0024] Where, d i Represents a ij With k i The Euclidean distance, p is a parameter set artificially. The larger the parameter, the greater the i The greater the impact of the change on the weight.

[0025] Preferably, in step S4, to determine the value of n, RMSPE is used to calculate the error degree of the fitting result, and the formula is as follows:

[0026]

[0027] In the formula, n is the number of points involved in the calculation, z i is the true height of a point, Fitting height for a certain point, the result is, E RMSPE The larger the error, the greater the error. RMSPE The smaller the error, the smaller the E RMSPE The smallest n is the n that needs to be used during fitting.

[0028] Preferably, in step S5, for all the intersection points a divided in step S2 ij , both get a ij The nearest n points around, by looping through all intersection points a ij After completing the z-value fitting, the obtained point data is returned to the CAD to draw a complete topographic map, and then the redundant points are deleted according to the original CAD outline; finally, the re-fitted elevation data is obtained, and the DEM model is generated using ArcGIS tools.

[0029] The beneficial effects of the present invention are as follows: the present invention uses the inverse distance weighted method and the root mean square percentage error to fit the elevation data, which has higher accuracy than the simple average elevation and software built-in interpolation fitting methods; it solves the problem that the data provided by the surveying and mapping team is not accurate enough or lacks key points and cannot accurately guide the construction; the elevation fitting value of any point in the construction area can be freely obtained as needed. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 It is a flow chart of a method for converting a topographic map to a DEM based on an inverse distance weighted method of the present invention;

[0031] Figure 2 It is a schematic diagram of a grid division example in the present invention. DETAILED DESCRIPTION

[0032] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. In the description of the present invention, it should be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside" and the like indicate directions or positional relationships based on the directions or positional relationships shown in the accompanying drawings, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as a limitation on the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.

[0033] The present invention will be further described below in conjunction with the accompanying drawings.

[0034] like Figure 1 As shown in FIG. 1 , a method for converting a topographic map to a DEM based on an inverse distance weighted method includes:

[0035] Step S1, parse the dxf format topographic map CAD file, extract the polyline, line segment and point data therein, and convert them into point data expressed by (x, y, z).

[0036] In the embodiment, firstly, the terrain file format is dxf. Since Python will not remove hidden layers when parsing the dxf file, it is necessary to ensure that there is no hidden irrelevant data in the dxf file before importing.

[0037] In the embodiment, the topographic map CAD file in dxf format is parsed, and the rules are as follows:

[0038] Polyline LWPOLYLINE: Get the coordinate points of each polyline and their corresponding heights, expressed as (x, y, z);

[0039] Line segment Line: Get the starting point and end point of each line, expressed as Start(x,y,z), End(x,y,z);

[0040] Point: Get the coordinates of each point, expressed as (x, y, z).

[0041] In the embodiment, polylines, line segments and point data represent terrain, and are ultimately decomposed into one or more three-dimensional points (x, y, z), where (x, y) represents the plane position of the point and z represents the height of the point. The goal of terrain fitting is to calculate an unknown point (x) from these known points in CAD. ij ,y ij )'s height z ij .

[0042] Step S2, grid division is performed on the range where data accuracy needs to be improved, and the division pattern is as follows: Figure 2 shown.

[0043] In the embodiment, for an area with CAD data, the maximum and minimum values ​​of x and y of all points in the area are obtained to obtain x min ,x max ,y min ,y max Four values, these four values ​​are combined to obtain the poles in the four directions of the area to be drawn, that is, the upper left corner A (x min ,y max ), upper right corner B(x max ,y max ), lower left corner C(x min ,y min ), lower right corner D(x max ,y min ), the area surrounded by these four points is the area where terrain fitting is required;

[0044] Then, the density of the fitted data is defined, and the step size Step parameter is used to determine the density of the fitted grid. According to experiments, a Step of 30 is generally sufficient to meet the requirements of DEM generation. The AB and AC lines are divided equally according to the step size, and the intersection point is recorded as a by connecting the equally divided points. ij , i represents the number of columns, j represents the number of rows, and a ij The coordinates are marked as (x ij ,y ij ), the fitting target is based on a ij The z values ​​of the surrounding known points are used to calculate a ij The z value of .

[0045] Step S3, using the inverse distance weighted method to calculate the fitting value.

[0046] In the embodiment, the inverse distance weighting method is used toij The z value is fitted, and the formula is as follows:

[0047]

[0048] In the formula, z represents a ij The height, w i Representative point k i Corresponding height z i The influence weight on z; w i The calculation method is as follows:

[0049]

[0050] Where, d i Represents a ij With k i The Euclidean distance, p is a parameter set artificially. The larger the parameter, the greater the i The greater the impact of the change on the weight.

[0051] Step S4, select several known points to calculate the error using RMSPE, and select the number of points n required for fitting when the error result is minimized.

[0052] In the embodiment, in order to determine the value of n, RMSPE is used to calculate the error degree of the fitting result, and the formula is as follows:

[0053]

[0054] In the formula, n is the number of points involved in the calculation, z i is the true height of a point, Fitting height for a certain point, the result is, E RMSPE The larger the error, the greater the error. RMSPE The smaller the error, the smaller the E RMSPE The smallest n is the n that needs to be used during fitting.

[0055] Step S5, using n to calculate all remaining grid points to obtain a DEM model.

[0056] In the embodiment, for all the intersection points a divided in step S2 ij (Generally there will be 5000-10000 points, determined by the step value in step S2), and all get a ij The nearest n points around, by looping through all intersection points a ij After completing the z-value fitting, the obtained point data is returned to the CAD to draw a complete topographic map, and then the redundant points are deleted according to the original CAD outline; finally, the re-fitted elevation data is obtained, and the DEM model is generated using ArcGIS tools.

[0057] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments may still be modified, or some or all of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for converting a topographic map to a DEM based on an inverse distance weighted method, characterized in that: include: Step S1, parsing the dxf format topographic map CAD file, extracting the polyline, line segment and point data therein, and converting them into point data expressed by (x, y, z); Step S2, gridding the range where data accuracy needs to be improved; Step S3, using the inverse distance weighted method to calculate the fitting value; Step S4, select several known points to calculate the error using RMSPE, and select the number of points n required for fitting when the error result is the smallest; Step S5, using n to calculate all remaining grid points to obtain a DEM model.

2. The method for converting a topographic map to a DEM based on an inverse distance weighted method according to claim 1, characterized in that: In step S1, the CAD file of the topographic map in dxf format is parsed according to the following rules: Polyline LWPOLYLINE: Get the coordinate points of each polyline and their corresponding heights, expressed as (x, y, z); Line segment Line: Get the starting point and end point of each line, expressed as Start(x,y,z), End(x,y,z); Point: Get the coordinates of each point, expressed as (x, y, z).

3. The method for converting a topographic map to a DEM based on an inverse distance weighted method according to claim 2, characterized in that: In step S1, the polyline, line segment and point data represent the terrain, and are ultimately decomposed into one or more three-dimensional points (x, y, z), where (x, y) represents the plane position of the point and z represents the height of the point; the goal of terrain fitting is to calculate an unknown point (x) from these known points in CAD. ij ,y ij )'s height z ij .

4. The method for converting a topographic map to a DEM based on an inverse distance weighted method according to claim 3, characterized in that: In step S2, for the area with CAD data, the maximum and minimum values ​​of x and y of all points in the area are obtained to obtain x min ,x max ,y min ,y max Four values, these four values ​​are combined to obtain the poles in the four directions of the area to be drawn, that is, the upper left corner A (x min ,y max ), upper right corner B(x max ,y max ), lower left corner C(x min ,y min ), lower right corner D(x max ,y min ), the area surrounded by these four points is the area where terrain fitting is required; Then, the density of the fitting data is defined, and the step size Step parameter is used to determine the fitting grid density. The two lines AB and AC are divided equally according to the step size, and the intersection point is connected to each other and recorded as a ij , i represents the number of columns, j represents the number of rows, and a ij The coordinates are marked as (x ij ,y ij ), the fitting target is based on a ij The z values ​​of the surrounding known points are used to calculate a ij The z value of .

5. The method for converting a topographic map to a DEM based on an inverse distance weighted method according to claim 4, characterized in that: In step S3, the inverse distance weighting method is used to ij The z value is fitted, and the formula is as follows: In the formula, z represents a ij The height, w i Representative point k i Corresponding height z i The influence weight on z; w i The calculation method is as follows: Where, d i Represents a ij With k i The Euclidean distance, p is a parameter set artificially. The larger the parameter, the greater the i The greater the impact of the change on the weight.

6. The method for converting a topographic map to a DEM based on an inverse distance weighted method according to claim 5, characterized in that: In step S4, in order to determine the value of n, RMSPE is used to calculate the error degree of the fitting result, and the formula is as follows: In the formula, n is the number of points involved in the calculation, z i is the true height of a point, Fitting height for a certain point, the result is, E RMSPE The larger the error, the greater the error. RMSPE The smaller the error, the smaller the E RMSPE The smallest n is the n that needs to be used during fitting.

7. The method for converting a topographic map to a DEM based on an inverse distance weighted method according to claim 6, characterized in that: In step S5, for all the intersection points a divided in step S2, ij , both get a ij The nearest n points around, by looping through all intersection points a ij After completing the z-value fitting, the obtained point data is returned to the CAD to draw a complete topographic map, and then the redundant points are deleted according to the original CAD outline; finally, the re-fitted elevation data is obtained, and the DEM model is generated using ArcGIS tools.