A method, device, terminal equipment and storage medium for processing elevation data
By hierarchically slicing and quantitatively storing elevation data, the problems of high redundancy and low access rate of elevation data in drone oblique photography are solved, and efficient data storage and improved three-dimensional modeling accuracy are achieved.
Patent Information
- Application Number
- CN202310114467.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-13
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2043-02-13
AI Technical Summary
Traditional drone oblique photography has high redundancy in elevation data due to the geodetic height obtained by the aircraft's GPS, complex storage data structure, and low access rate. It is difficult to effectively capture the vertical facade details of areas with large undulating terrain, affecting the accuracy and safety of three-dimensional modeling.
By slicing the elevation data hierarchically, generating map tiles, calculating the elevation difference and quantizing the storage according to the size of the difference, using different bytes to store the quantized elevation difference and count value, generating the quantized elevation difference with the elevation interval as the counting unit, and optimizing the storage file structure.
It greatly reduces the storage size of elevation data, improves data access efficiency, and ensures the accuracy and security of elevation data.
Smart Images

Figure CN116309000B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of elevation terrain data, and in particular to a method for processing elevation data. Background Art
[0002] Drone oblique photography is a new technology for 3D scene reconstruction that has developed in recent years. However, in traditional drone oblique photography, since the GPS onboard the aircraft obtains the geodetic height based on the geoid, the drone's flight altitude is often a fixed value. As a result, the images captured cannot well capture the vertical facade details of areas with large undulating terrain, resulting in 3D modeling failures. Therefore, to ensure the accuracy and safety of flight results, terrain-simulating flight has gradually become the key to achieving fine 3D modeling in complex terrain areas. However, according to existing storage technologies, HeightMap's elevation data lacks compression, has high data redundancy, and is slow to read in real time online. Quantized-mesh triangulation forms store the triangulation network itself, which has many index files, a complex data structure, and an increased total storage volume. Therefore, how to improve the access rate of elevation data is an urgent problem that needs to be solved. Summary of the Invention
[0003] The present invention provides a method for processing elevation data, which can greatly reduce the size of stored data and improve data access efficiency.
[0004] A method for processing elevation data includes: acquiring elevation data, slicing the elevation data in a hierarchical manner, and generating a first map tile of any level;
[0005] determining a first elevation interval based on a level of the first map tile, a first elevation value of a lowest elevation point in the level, and a second elevation value of a highest elevation point in the level;
[0006] Calculating the elevation difference between adjacent elevation points, and for each elevation difference, determining whether the elevation difference is greater than a first threshold;
[0007] When it is determined that the elevation difference is greater than a first threshold, subtracting the elevation value of the current elevation point from the first elevation value, dividing the result of the subtraction by the elevation interval to generate a first quantized elevation difference value with the first elevation interval as a counting unit, and storing the first quantized elevation difference value in an elevation array of a preset first storage file;
[0008] When it is determined that the elevation difference is less than or equal to the first threshold, determine whether the elevation difference is greater than a second threshold; if so, divide the elevation difference by the first elevation interval, add a first preset value to the result of the division, generate a second quantized elevation difference with the first elevation interval as a counting unit, and store the second quantized elevation difference in an elevation array of a preset first storage file; if not, update the first count value, and store the updated first count value in the elevation array of the preset first storage file; wherein the first threshold is greater than the second threshold, the first threshold and the second threshold are used to determine the degree of terrain undulation between two adjacent elevation points, and the first count value is used to count the number of consecutive elevation points whose elevation difference is less than the second threshold;
[0009] The first elevation value, the second elevation value, and the level of the first map tile are stored in a header file of a preset first storage file.
[0010] Furthermore, determining the first elevation interval according to the level of the first map tile, the first elevation value of the lowest elevation point in the level, and the second elevation value of the highest elevation point in the level includes:
[0011] Determining, according to the level to which the first map tile belongs, an accuracy index to which the first map tile level belongs;
[0012] Determining a first to-be-determined elevation interval according to the layer to which the first map tile belongs and the accuracy index;
[0013] Determining a second to-be-determined elevation interval according to the first elevation value of the lowest elevation point, the second elevation value of the highest elevation point, and a preset first preset value;
[0014] The first undetermined elevation interval is compared with the second undetermined elevation interval, and the smaller one is used as the first elevation interval.
[0015] Furthermore, the number of elevation points to be interpreted and the third elevation value of the initial first elevation point are stored in a header file of the preset first storage file.
[0016] Further, when it is determined that the elevation difference is greater than a first threshold, it is determined that the first quantized elevation difference needs to be stored using two bytes, and a first storage state value for identifying the number of bytes required to store the first quantized elevation difference is stored in a preset first single-byte array;
[0017] When it is determined that the elevation difference is less than or equal to the first threshold, it is determined that the second quantized elevation difference needs to be stored using one byte, and a second storage state value for identifying the number of bytes required to store the second quantized elevation difference is stored in a preset first single-byte array.
[0018] Furthermore, generating the first threshold value includes: multiplying a preset second preset value by the first elevation interval to generate the first threshold value;
[0019] Generating the second threshold includes: multiplying a preset third preset value by the first elevation interval to generate the second threshold;
[0020] The second preset value is greater than the first preset value, and the first preset value is greater than the third preset value.
[0021] Further, obtaining a second storage file storing compressed elevation data;
[0022] Extract the level of the second map tile, the second single-byte array, the fourth elevation value of the lowest elevation point, the fifth elevation value of the highest elevation point, and the sixth elevation value of the initial first elevation point from the header file of the second storage file.
[0023] determining a second elevation interval according to the level of the second map tile;
[0024] Sequentially reading each storage state value in the second single-byte array, and when the first storage state value is read, reading a third quantized elevation difference value stored in 2 bytes at a corresponding position in the elevation array of the second storage file; multiplying the third quantized elevation difference value by the first elevation interval, and then adding the result of the multiplication to the fourth elevation value, and using the result of the addition as the decoded elevation value;
[0025] When the second storage state value is read, determine whether the value of the corresponding position in the elevation array of the second storage file is less than the preset second preset value. If so, read the fourth quantized elevation difference value stored in 1 byte in the corresponding position in the elevation array, subtract the first preset value from the fourth quantized elevation difference value, divide the subtraction result by the second elevation interval, add the division result to the elevation value of the previous elevation point, and use the added result as the decoded elevation value; otherwise, read the second count value stored in 1 byte in the corresponding position in the elevation array, and restore the elevation values of several consecutive elevation points corresponding to the second count value.
[0026] Furthermore, the elevation values of several consecutive elevation points corresponding to the count value are restored by the following formula:
[0027] Height[i]=Height[i-1]+(nextHeight–
[0028] Height[i-count_dH[i]+240+1]) / (count_dH[i]-240);
[0029] Among them, Height[i] represents the elevation value of elevation point i; Height[i-1] represents the elevation value of the previous elevation point of elevation point i; nextHeight represents the first quantized elevation difference recorded in 2 bytes after counting consecutive elevation values when the terrain is particularly flat; count_dH[i] represents the third quantized elevation difference, the fourth quantized elevation difference or the second count value of elevation point i.
[0030] Based on the above method embodiment, the present invention provides a corresponding device embodiment;
[0031] The present invention provides an elevation data processing device, comprising: a data acquisition module, an elevation interval determination module, a quantization storage module, and a header file storage module;
[0032] The data acquisition module is used to acquire elevation data, hierarchically slice the elevation data, and generate first map tiles of any level;
[0033] The elevation interval determination module is configured to determine a first elevation interval based on a level of the first map tile, a first elevation value of a lowest elevation point in the level, and a second elevation value of a highest elevation point in the level;
[0034] The quantization storage module is used to calculate the elevation difference between adjacent elevation points, and for each elevation difference, determine whether the elevation difference is greater than a first threshold;
[0035] When it is determined that the elevation difference is greater than a first threshold, subtracting the elevation value of the current elevation point from the first elevation value, dividing the result of the subtraction by the elevation interval to generate a first quantized elevation difference value with the first elevation interval as a counting unit, and storing the first quantized elevation difference value in an elevation array of a preset first storage file;
[0036] When it is determined that the elevation difference is less than or equal to the first threshold, determine whether the elevation difference is greater than a second threshold; if so, divide the elevation difference by the first elevation interval, add a first preset value to the result of the division, generate a second quantized elevation difference with the first elevation interval as a counting unit, and store the second quantized elevation difference in an elevation array of a preset first storage file; if not, update the first count value, and store the updated first count value in the elevation array of the preset first storage file; wherein the first threshold is greater than the second threshold, the first threshold and the second threshold are used to determine the degree of terrain undulation between two adjacent elevation points, and the first count value is used to count the number of consecutive elevation points whose elevation difference is less than the second threshold;
[0037] The header file storage module is used to store the first elevation value, the second elevation value and the level of the first map tile in a header file of a preset first storage file.
[0038] Based on the above method embodiment, the present invention provides a corresponding terminal device embodiment;
[0039] The present invention provides a terminal device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements any one of the elevation data processing methods when executing the computer program.
[0040] Based on the above method embodiment, the present invention provides a storage medium embodiment;
[0041] The present invention provides a storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute any one of the elevation data processing methods.
[0042] The embodiments of the present invention have the following beneficial effects:
[0043] The present invention provides an elevation data storage method, which first slices elevation data hierarchically to generate map tiles of any level, determines the elevation interval of the map tiles, and then calculates the elevation difference of each adjacent elevation point; when it is determined that the elevation difference is greater than a first threshold, calculates and generates a first quantized elevation difference with the elevation interval as a counting unit; when it is determined that the elevation difference is less than or equal to the first threshold, determines whether the elevation difference is greater than a second threshold, and if so, calculates and generates a second quantized elevation difference with the elevation interval as a counting unit, and if not, updates the count value; for Each of the first quantized elevation difference values is stored using 2 bytes, and each of the second quantized elevation difference values or each of the count values is stored using 1 byte. At the same time, a second quantized elevation difference value and a count value can be stored in one byte. By implementing the present invention, the elevation differences of each adjacent elevation point can be calculated based on the elevation interval of each elevation point in the map tile, and the elevation differences of each adjacent elevation point can be quantized. The quantized elevation differences can be used to replace the original elevation values for storage, which greatly reduces the size of the stored data and improves the data access efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 This is a schematic diagram of the steps of the elevation data storage method of the present invention;
[0045] Figure 2 This is a schematic diagram of using WGS84 longitude and latitude coordinates provided by one embodiment of the present invention;
[0046] Figure 3 This is a schematic diagram of map classification and coordinates provided by an embodiment of the present invention;
[0047] Figure 4 Schematic diagram of accuracy indicators of different tile ground resolutions provided by an embodiment of the present invention;
[0048] Figure 5 This is a schematic diagram of the elevation data compression process provided by one embodiment of the present invention;
[0049] Figure 6 This is a schematic diagram of the steps of the elevation data interpretation process provided by one embodiment of the present invention;
[0050] Figure 7 This is a schematic diagram of a storage file for each elevation block provided by an embodiment of the present invention;
[0051] Figure 8 1 is a schematic diagram of the elevation data interpretation process provided by one embodiment of the present invention;
[0052] Figure 9 1 is a schematic diagram of linearized restoration of elevation values provided by an embodiment of the present invention;
[0053] Figure 10 It is a structural schematic diagram of an elevation data storage device provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0054] The following will clearly and completely describe the technical solutions of the present invention in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0055] like Figure 1 As shown, Figure 1 The present invention provides a method for processing elevation data, which includes steps S101 to S104. The specific steps are as follows:
[0056] Step S101: obtaining elevation data, slicing the elevation data hierarchically, and generating first map tiles of any level;
[0057] Step S102: determining a first elevation interval according to the level of the first map tile, a first elevation value of the lowest elevation point in the level, and a second elevation value of the highest elevation point in the level;
[0058] Step S103: calculating the elevation difference between adjacent elevation points, and for each elevation difference, generating a first quantized elevation difference value or a second quantized elevation difference value or a first count value, and storing the generated values in an elevation array of a preset first storage file;
[0059] Step S104: storing the first elevation value, the second elevation value, and the level of the first map tile in a header file of a preset first storage file.
[0060] It should be noted that the first to nth elevation values described in this application have no special meaning and are merely used to distinguish the various elevation values; similarly, the first to nth map tiles, elevation intervals, single-byte arrays, quantized elevation differences, preset values, and storage files described in this application are also the same;
[0061] For step S101, in an optional embodiment, the terrain elevation data is hierarchically sliced according to the web map tile service WMTS. The terrain elevation data is segmented using tiles segmented by a standardized grid. The tile resolution is 256×256 and each tile has a unique tile level (Level) and tile coordinate number (tileX, tileY). The level can be calculated forward and backward according to the coordinates and tile row and column numbers. In the official WMTS standard, the origin of the tile map Web-Mercator projection coordinate system is specified to be 180° east longitude and 85.05° south latitude, with the x-axis pointing right and the y-axis pointing upward. The minimum tile level (zoomlevel) is 0 and the maximum is 24.
[0062] Indicative, such as Figure 2 and Figure 3 As shown, the coordinate system is the WGS84 geodetic coordinate system ( <srs> EPSG:4326< / srs> ); for any level (n), the tile pixel resolution of the tile set at that level is units-per-pixel = 0.703125 / 2^n; level 0 is two 256x256 pixel tiles (geographic size is 180*180 degrees) covering the entire world, with the coordinate origin at -180,90;
[0063] The calculation relationship between tile coordinates and longitude and latitude, longitude and latitude coordinates (lng, lat) to tile coordinates (tileX, tileY), the zoom level is n, is expressed by the following formula:
[0064]
[0065] The conversion of longitude and latitude (lng, lat) to pixel coordinates (pixelX, pixelY) is expressed by the following formula:
[0066]
[0067] The pixel coordinates (pixelX, pixelY) of a tile (tileX, tileY) are converted to longitude and latitude coordinates (lng, lat) as shown in the following formula:
[0068]
[0069] Regarding step S102, in an optional embodiment, determining the first elevation interval according to the level of the first map tile, the first elevation value of the lowest elevation point in the level, and the second elevation value of the highest elevation point in the level includes:
[0070] Determining, according to the level to which the first map tile belongs, an accuracy index to which the first map tile level belongs;
[0071] Determining a first to-be-determined elevation interval according to the layer to which the first map tile belongs and the accuracy index;
[0072] Determining a second to-be-determined elevation interval according to the first elevation value of the lowest elevation point, the second elevation value of the highest elevation point, and a preset first preset value;
[0073] The first undetermined elevation interval is compared with the second undetermined elevation interval, and the smaller one is used as the first elevation interval.
[0074] Specifically, the first undetermined elevation interval is represented by P_dH, which is a 4-byte floating point number and belongs to the 1-20 level tile accuracy index. The calculation formula is P_dH=P0_dH*2 20-n ; Among them, P0_dH represents the above-mentioned precision index, which is a 4-byte floating point number, indicating the 20-level tile classification precision index, with a value of 0.01 meter; n represents the tile level (1-20);
[0075] The second undetermined elevation interval is represented by u_dH, which is a 4-byte floating point number and is calculated as u_dH = (maxHeight - minHeight) / 65535, where maxHeight represents the elevation of the highest elevation point, minHeight represents the elevation of the lowest elevation point, and 65535 is the first preset value mentioned above.
[0076] The first elevation interval is represented by dH, a 4-byte floating point number, which can be u_dH or P_dH; when P_dH>u_dH, dH=u_dH; otherwise, dH=P_dH.
[0077] For step S103, in an optional embodiment, the number of elevation points to be interpreted is stored in a header file of a preset storage file, as shown in the following table:
[0078]
[0079]
[0080] In step S104, in a preferred embodiment, the elevation difference between adjacent elevation points is calculated, and for each elevation difference, it is determined whether the elevation difference is greater than a first threshold;
[0081] When it is determined that the elevation difference is greater than a first threshold, subtracting the elevation value of the current elevation point from the first elevation value, dividing the result of the subtraction by the elevation interval to generate a first quantized elevation difference value with the first elevation interval as a counting unit, and storing the first quantized elevation difference value in an elevation array of a preset first storage file;
[0082] When it is determined that the elevation difference is less than or equal to the first threshold, determine whether the elevation difference is greater than a second threshold; if so, divide the elevation difference by the first elevation interval, add the result after the division to a first preset value, generate a second quantized elevation difference with the first elevation interval as a counting unit, and store the second quantized elevation difference in an elevation array of a preset first storage file; if not, update the first count value, and store the updated first count value in an elevation array of a preset first storage file; wherein, the first threshold is greater than the second threshold, the first threshold and the second threshold are used to determine the degree of terrain undulation between two adjacent elevation points, and the first count value is used to count the number of consecutive elevation points whose elevation difference is less than the second threshold.
[0083] In an optional embodiment, generating the first threshold value includes: multiplying a preset second preset value by the first elevation interval to generate the first threshold value;
[0084] Generating the second threshold includes: multiplying a preset third preset value by the first elevation interval to generate the second threshold;
[0085] The second preset value is greater than the first preset value, and the first preset value is greater than the third preset value.
[0086] Specifically, first read the elevation value of the first elevation point in the elevation block, then store the elevation value of the first elevation point in 2 bytes, and then start from the second elevation point and read the elevation value of the i-th elevation point in sequence;
[0087] The elevation difference of each adjacent elevation point is calculated by taking the difference between the elevation values of two adjacent elevation points (or the elevation value of the current point minus the elevation value of the previous point, and then adding the absolute value of the subtraction result); after obtaining the elevation difference, determine whether it is greater than the first threshold. When the elevation difference is greater than the first threshold, it means that the terrain is undulating and the degree of undulation is large. The judgment formula is as follows:
[0088] fabs(fb_dH)>240*dH;
[0089] Wherein, fabs() is an absolute value function, fb_dH represents the elevation difference, dH represents the first elevation interval, 240 is the second preset value, and 240*dH is the first threshold.
[0090] The first quantized elevation difference is calculated using the following formula:
[0091] count_dH[i]=(Height[i]-minHeight) / u_dH;
[0092] Where count_dH[i] represents an array for storing the first quantized elevation difference, the second quantized elevation difference, and the first count value; Height[i] represents the elevation value of point i, i.e., the elevation value of the current elevation point; minHeight represents the first elevation value of the lowest elevation point; and u_dH represents that the first elevation interval at this time is the second undetermined elevation interval;
[0093] When the elevation difference is less than or equal to the first threshold, it means that the terrain is particularly flat or the terrain is not very undulating. In order to distinguish, further judgment is needed to determine whether the elevation difference is greater than the second threshold. If it is greater than, it means that the terrain is not very undulating. If it is less than or equal to the second threshold, it means that the terrain is particularly flat. The judgment formula is as follows:
[0094] fabs(fb_dH)>15*dH;
[0095] Wherein, 15 is the third preset value mentioned above, and 15*dH is the second threshold mentioned above;
[0096] When the terrain is relatively smooth, the second quantized elevation difference is calculated using the following formula:
[0097] count_dH[i]=(Height[i]-Height[i-1]) / P_dH+120;
[0098] Wherein, P_dH indicates that the first elevation interval at this time is the first undetermined elevation interval, 120 is the first preset value mentioned above; Height[i-1] indicates the elevation value of the previous elevation point of the current elevation point i, and Height[i] indicates the elevation value of the current elevation point i;
[0099] When the terrain is particularly flat, count_dH[i] is used only as a count mark, that is, only the first count value is saved, indicating that there are (count_dH[i]-240) consecutive elevation values that meet the requirements. When the elevation is restored, it is restored in a linear form. For example, if count_dH[i] = 253, it means that there are 13 consecutive elevation values (253-240=13) with very small differences. For example, if the elevation values are 220.1, 220.2, 220.3, 220.4, 220.1, 220.2, and 220.4, with very small elevations in between, then only the elevation value of 220.1 needs to be recorded, and then count_dH will be 6, indicating that there are 6 consecutive very small elevation values in between.
[0100] In an optional embodiment, when it is determined that the elevation difference is greater than a first threshold, it is determined that the first quantized elevation difference needs to be stored using two bytes, and a first storage state value for identifying the number of bytes required to store the first quantized elevation difference is stored in a preset first single-byte array;
[0101] When it is determined that the elevation difference is less than or equal to a first threshold, determining that the second quantized elevation difference needs to be stored using one byte, and storing a second storage state value for identifying the number of bytes required to store the second quantized elevation difference in a preset first single-byte array;
[0102] Specifically, the first storage state value is 0, the second storage state value is 1, and the preset first single-byte array is byte[]. When it is determined that the elevation difference is greater than the first threshold, it indicates that the terrain is undulating and the undulation is large, and the calculated first quantized elevation difference will be relatively large. In this case, the first storage state value is stored in the preset first single-byte array, which can be expressed as byte[i]=0, indicating that the first quantized elevation difference needs to be stored using 2 bytes.
[0103] When it is determined that the elevation difference is less than or equal to the first threshold, it means that the terrain is particularly flat or the terrain is relatively undulating. Then, a second storage state value is stored in the preset first single-byte array, which can be expressed as byte[i]=0, which is used to identify the second quantized elevation difference or the count value. Only one byte is needed to store it. In order to distinguish, further judgment is needed to determine whether the elevation difference is greater than the second threshold. If it is greater than, it indicates that the terrain is relatively undulating. If it is less than or equal to, it indicates that it is particularly flat at this time. In the case of relatively undulating terrain, the second quantized elevation difference is calculated and generated. is relatively small; in addition, when the terrain is particularly flat, the generated count value is also very small; when the second quantized elevation difference value and the count value are both very small, the second quantized elevation difference value and the count value can be stored in the same byte; for example, the storage range of a byte is (0-255), then the storage range of the second quantized elevation difference value in the byte is (0-240), and the storage range of the count value is (241-255); that is, the count value of the second quantized elevation difference value in the byte can only reach 15 at most. If it exceeds 15, the part exceeding 15 will be stored in the next byte;
[0104] It should also be noted that the elevation interval quantization rule compresses the original 16-byte integer elevation value into a 2-byte or 1-byte integer for storage. The number of bytes is determined based on the accuracy requirements of different tile ground resolutions in the "GB / T 35634-2017 Public Service Electronic Map Tile Data Specification", such as Figure 4 As shown;
[0105] According to the tile division rules, the size range of each tile is 256pixel*256pixel. According to the national standard for electronic maps, the grading accuracy indicators of different tile levels, when the elevation interval count_dH is stored in 2 bytes, it can store 2^16 multiples of p_dH differences, and the elevation interval 1 byte can store a maximum of 255 multiples of p_dH elevation differences. The places with the largest elevation difference in the world are the top of Mount Everest and the Dead Sea in western Asia. The altitude of Mount Everest is 8844.43 meters, and the altitude of the Dead Sea is -400 meters (400 meters below sea level). The altitude difference between the two places is 9244.43 meters. Based on the maximum elevation difference, tiles of levels 1-17 can be recorded, and the coverage of a tile is limited, and will not exceed the elevation difference range. The schematic is shown in the following table:
[0106]
[0107]
[0108] The above steps S101 to S104 are steps for compressing and storing elevation data. Figure 5In a preferred embodiment, after the elevation data is stored, if it is necessary to interpret the stored data, such as Figure 6 As shown, the interpretation process includes the following steps:
[0109] Step S201, obtaining a second storage file storing compressed elevation data;
[0110] Step S202: extract the level of the second map tile, the second single-byte array, the fourth elevation value of the lowest elevation point, the fifth elevation value of the highest elevation point, and the sixth elevation value of the initial first elevation point from the header file of the second storage file.
[0111] Step S203, determining a second elevation interval according to the level of the second map tile;
[0112] Step S204: Read the third quantized elevation difference value, the fourth quantized elevation difference value, or the second count value through each storage state value in the second single-byte array, and restore the elevation value of each elevation point;
[0113] For step S201, in an optional embodiment, the preset second storage file uses little-endian binary data. The data elevation compression format of this patent is as follows: Figure 7 As shown, it includes the fourth elevation value of the lowest elevation point, the fifth elevation value of the highest elevation point, the total number of elevation points to be interpreted, the level of the second map tile, and the sixth elevation value of the first elevation point at the beginning, as well as the count_dH array stored in the elevation array, including the third quantized elevation difference value, the fourth quantized elevation difference value and the second count value stored in the count_dH array.
[0114] In step S202, extract the level of the first map tile, the first single-byte array, the point elevation value of the first lowest elevation point, the elevation value of the first highest elevation point, and the elevation value of the first elevation point at the first initial time from the header file of the second storage file;
[0115] Regarding step S203, determining the second elevation interval according to the level of the second map tile, the method thereof can be referred to the above step S102 and will not be repeated here;
[0116] In step S204, in a preferred embodiment, each storage state value in the second single-byte array is read in sequence. When the first storage state value is read, a third quantized elevation difference value stored in two bytes is read from the corresponding position in the elevation array of the second storage file. The third quantized elevation difference value is multiplied by the first elevation interval, and the result of the multiplication is added to the fourth elevation value, and the result of the addition is used as the decoded elevation value.
[0117] When the second storage state value is read, determine whether the value of the corresponding position in the elevation array of the second storage file is less than the preset second preset value. If so, read the fourth quantized elevation difference value stored in 1 byte in the corresponding position in the elevation array, subtract the first preset value from the fourth quantized elevation difference value, divide the subtraction result by the second elevation interval, add the division result to the elevation value of the previous elevation point, and use the added result as the decoded elevation value; otherwise, read the second count value stored in 1 byte in the corresponding position in the elevation array, and restore the elevation values of several consecutive elevation points corresponding to the second count value.
[0118] In an optional embodiment, the elevation values of the plurality of consecutive elevation points are restored by the following formula:
[0119] Height[i]=Height[i-1]+(nextHeight–
[0120] Height[i-count_dH[i]+240+1]) / (count_dH[i]-240);
[0121] Among them, Height[i] represents the elevation value of elevation point i; Height[i-1] represents the elevation value of the previous elevation point of elevation point i; nextHeight represents the first quantized elevation difference recorded in 2 bytes after counting consecutive elevation values when the terrain is particularly flat; count_dH[i] represents the third quantized elevation difference, the fourth quantized elevation difference or the second count value of elevation point i.
[0122] Specifically, such as Figure 8 As shown, each storage state value in the preset second single-byte array byte[i] is read. If the read storage state value is 0, the third quantized elevation difference value stored in 2 bytes is read in count_dH[i]. If the read storage state value is 1, it means that count_dH[i] is stored in 1 byte. However, since the third quantized elevation difference value and the second count value can be stored in one byte together, it is necessary to judge next. If count_dH[i] is less than or equal to 240, that is, when the terrain undulation is relatively small, the fourth quantized elevation difference value is read from 1 byte of count_dH[i], and the elevation value of elevation point i is calculated by the following formula:
[0123] Height[i]=(count_dH[i]-120)*P_dH+Height[i-1];
[0124] If count_dH[i] is greater than 240, that is, the terrain is particularly flat, then the second count value can be read from one byte of count_dH[i]. Since the storage range of one byte is 0-255, that is, the storage range of the second count value can only be (241, 255), and the maximum size of the count value that can be stored is 15. If the count value is greater than 15, then the next byte is used to store the part greater than 15. Schematically, the elevation values of the several consecutive elevation points are restored in a linearized form, such as Figure 9 As shown;
[0125] It should be noted that in the process of interpreting the stored data, the start and stop of the interpretation are determined by the Length in the header file of the preset second storage file. Length is the total number of elevation points to be interpreted in this elevation block. The total number of elevation values that need to be interpreted is determined based on the total number of Length. When the number of interpreted elevation values reaches Length, the interpretation process is stopped.
[0126] Based on the above method embodiments, the present invention provides corresponding device embodiments.
[0127] like Figure 10 As shown, an embodiment of the present invention provides an elevation data processing device, comprising: a data acquisition module, an elevation interval determination module, a quantization storage module, and a header file storage module;
[0128] The data acquisition module is used to acquire elevation data, hierarchically slice the elevation data, and generate first map tiles of any level;
[0129] The elevation interval determination module is configured to determine a first elevation interval based on a level of the first map tile, a first elevation value of a lowest elevation point in the level, and a second elevation value of a highest elevation point in the level;
[0130] The quantization storage module is used to calculate the elevation difference between adjacent elevation points, and for each elevation difference, determine whether the elevation difference is greater than a first threshold;
[0131] When it is determined that the elevation difference is greater than a first threshold, subtracting the elevation value of the current elevation point from the first elevation value, dividing the result of the subtraction by the elevation interval to generate a first quantized elevation difference value with the first elevation interval as a counting unit, and storing the first quantized elevation difference value in an elevation array of a preset first storage file;
[0132] When it is determined that the elevation difference is less than or equal to the first threshold, determine whether the elevation difference is greater than a second threshold; if so, divide the elevation difference by the first elevation interval, add a first preset value to the result of the division, generate a second quantized elevation difference with the first elevation interval as a counting unit, and store the second quantized elevation difference in an elevation array of a preset first storage file; if not, update the first count value, and store the updated first count value in the elevation array of the preset first storage file; wherein the first threshold is greater than the second threshold, the first threshold and the second threshold are used to determine the degree of terrain undulation between two adjacent elevation points, and the first count value is used to count the number of consecutive elevation points whose elevation difference is less than the second threshold;
[0133] The header file storage module is used to store the first elevation value, the second elevation value and the level of the first map tile in a header file of a preset first storage file.
[0134] It should be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art can understand and implement the present invention without inventive effort.
[0135] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0136] Based on the above method embodiment, the present invention provides a corresponding terminal device embodiment.
[0137] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor; when the processor executes the computer program, the elevation data processing method of any embodiment of the present invention is implemented.
[0138] For example, in this embodiment, the computer program may be divided into one or more modules, which are stored in the memory and executed by the processor to implement the present invention. The one or more module elements may be a series of computer program instruction segments capable of implementing specific functions, and the instruction segments are used to describe the execution process of the computer program in the device;
[0139] The device may be a computing device such as a desktop computer, a laptop, a PDA, a cloud server, etc. The device may include, but is not limited to, a processor, a memory;
[0140] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the device, connecting various parts of the entire device using various interfaces and lines;
[0141] The memory can be used to store the computer programs and / or modules, and the processor realizes various functions of the device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; in addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0142] Based on the above method embodiment, the present invention provides a corresponding storage medium embodiment.
[0143] Another embodiment of the present invention provides a storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute the elevation data processing method of any embodiment of the present invention.
[0144] In this embodiment, the storage medium is a computer-readable storage medium, and the computer program includes computer program code, which may be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0145] In summary, the present invention provides a method for processing elevation data. During data storage, continuous elevation differences are used as a measurement indicator. The two elevation intervals, u_dH and P_dH, are used as indicator units for elevation quantization. The generated first and second quantized elevation differences and count values replace the original elevation values, abandoning the direct storage of elevation values. The elevation interval quantization rule compresses the original 16-byte integer elevation values into 2-byte integers for storage. For extremely flat terrain, the count value is generated by counting the number of elevation points, and the elevation values are not stored. During elevation interpretation, the elevation points are directly linearized using the initial and final elevation values of the continuous elevation data segment. Furthermore, the present invention uses a short byte[i] single-byte array as a flag value to further compress elevation data. Binary 1 / 0 data is used to indicate whether the elevation difference quantization count is 2 bytes or 1 byte, thereby compressing elevation storage space. Thus, through the above embodiments, the present invention can significantly reduce the size of stored data, compress storage space, simplify the data storage structure, and improve data access efficiency.
[0146] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for processing elevation data, characterized in that: include: Acquire elevation data, and perform hierarchical slicing on the elevation data to generate first map tiles of any level; determining a first elevation interval based on a level of the first map tile, a first elevation value of a lowest elevation point in the level, and a second elevation value of a highest elevation point in the level; Calculating the elevation difference between adjacent elevation points, and for each elevation difference, determining whether the elevation difference is greater than a first threshold; When it is determined that the elevation difference is greater than a first threshold, subtracting the elevation value of the current elevation point from the first elevation value, dividing the result of the subtraction by a first elevation interval, generating a first quantized elevation difference value with the first elevation interval as a counting unit, and storing the first quantized elevation difference value in an elevation array of a preset first storage file; When it is determined that the elevation difference is less than or equal to the first threshold, determining whether the elevation difference is greater than a second threshold; If so, dividing the elevation difference by the first elevation interval, adding a first preset value to the result of the division, generating a second quantized elevation difference with the first elevation interval as a counting unit, and storing the second quantized elevation difference in an elevation array of a preset first storage file; If not, then updating the first count value and storing the updated first count value in an elevation array of a preset first storage file; wherein the first threshold value is greater than the second threshold value, the first threshold value and the second threshold value are used to determine the degree of terrain undulation between two adjacent elevation points, and the first count value is used to count the number of consecutive elevation points whose elevation difference is less than the second threshold value; storing the first elevation value, the second elevation value, and the level of the first map tile in a header file of a preset first storage file; When it is determined that the elevation difference is greater than a first threshold, it is determined that the first quantized elevation difference needs to be stored using two bytes, and a first storage state value for identifying the number of bytes required to store the first quantized elevation difference is stored in a preset first single-byte array; When it is determined that the elevation difference is less than or equal to the first threshold, it is determined that the second quantized elevation difference needs to be stored using one byte, and a second storage state value for identifying the number of bytes required to store the second quantized elevation difference is stored in a preset first single-byte array.
2. A method for processing elevation data according to claim 1, characterized in that: The determining of the first elevation interval according to the level of the first map tile, the first elevation value of the lowest elevation point in the level, and the second elevation value of the highest elevation point in the level includes: Determining, according to the level to which the first map tile belongs, an accuracy index to which the first map tile level belongs; Determining a first to-be-determined elevation interval according to the layer to which the first map tile belongs and the accuracy index; Determining a second to-be-determined elevation interval according to the first elevation value of the lowest elevation point, the second elevation value of the highest elevation point, and a preset first preset value; The first undetermined elevation interval is compared with the second undetermined elevation interval, and the smaller one is used as the first elevation interval.
3. A method for processing elevation data according to claim 1, characterized in that: Also includes: The total number of elevation points to be interpreted and the third elevation value of the initial first elevation point are stored in the header file of the preset first storage file.
4. A method for processing elevation data according to claim 1, characterized in that: Generating the first threshold includes: multiplying a preset second preset value by the first elevation interval to generate the first threshold; Generating the second threshold includes: multiplying a preset third preset value by the first elevation interval to generate the second threshold; The second preset value is greater than the first preset value, and the first preset value is greater than the third preset value.
5. The method for processing elevation data according to claim 1, wherein: Also includes: Acquire a second storage file storing compressed elevation data; Extracting the level of the second map tile, the second single-byte array, the fourth elevation value of the lowest elevation point, the fifth elevation value of the highest elevation point, and the sixth elevation value of the initial first elevation point from the header file of the second storage file; determining a second elevation interval according to the level of the second map tile; Sequentially reading each storage state value in the second single-byte array, and when the first storage state value is read, reading a third quantized elevation difference value stored in 2 bytes at a corresponding position in the elevation array of the second storage file; multiplying the third quantized elevation difference value by the second elevation interval, and then adding the result of the multiplication to the fourth elevation value, and using the result of the addition as the decoded elevation value; When the second storage state value is read, determine whether the value at the corresponding position in the elevation array of the second storage file is less than the preset second preset value. If so, read the fourth quantized elevation difference value stored in 1 byte in the corresponding position in the elevation array, subtract the first preset value from the fourth quantized elevation difference value, multiply the subtraction result by the second elevation interval, add the multiplication result to the elevation value of the previous elevation point, and use the added result as the decoded elevation value; otherwise, read the second count value stored in 1 byte in the corresponding position in the elevation array, and restore the elevation values of several consecutive elevation points corresponding to the second count value.
6. A method for processing elevation data according to claim 5, characterized in that: The following formula is used to restore the elevation values of several consecutive elevation points corresponding to the count value: Height[i]=Height[i-1]+(nextHeight– Height[i-count_dH[i]+240+1]) / (count_dH[i]-240); Among them, Height[i] represents the elevation value of elevation point i; Height[i-1] represents the elevation value of the previous elevation point of elevation point i; nextHeight represents the first quantized elevation difference recorded in 2 bytes after counting consecutive elevation values when the terrain is particularly flat; count_dH[i] represents the third quantized elevation difference, the fourth quantized elevation difference or the second count value of elevation point i.
7. A device for processing elevation data, characterized in that: include: Data acquisition module, elevation interval determination module, quantization storage module and header file storage module; The data acquisition module is used to acquire elevation data, hierarchically slice the elevation data, and generate first map tiles of any level; The elevation interval determination module is configured to determine a first elevation interval based on a level of the first map tile, a first elevation value of a lowest elevation point in the level, and a second elevation value of a highest elevation point in the level; The quantization storage module is used to calculate the elevation difference between adjacent elevation points, and for each elevation difference, determine whether the elevation difference is greater than a first threshold; When it is determined that the elevation difference is greater than a first threshold, subtracting the elevation value of the current elevation point from the first elevation value, dividing the result of the subtraction by a first elevation interval, generating a first quantized elevation difference value with the first elevation interval as a counting unit, and storing the first quantized elevation difference value in an elevation array of a preset first storage file; When it is determined that the elevation difference is less than or equal to the first threshold, determining whether the elevation difference is greater than a second threshold; If so, dividing the elevation difference by the first elevation interval, adding a first preset value to the result of the division, generating a second quantized elevation difference with the first elevation interval as a counting unit, and storing the second quantized elevation difference in an elevation array of a preset first storage file; If not, then updating the first count value and storing the updated first count value in an elevation array of a preset first storage file; wherein the first threshold value is greater than the second threshold value, the first threshold value and the second threshold value are used to determine the degree of terrain undulation between two adjacent elevation points, and the first count value is used to count the number of consecutive elevation points whose elevation difference is less than the second threshold value; The header file storage module is used to store the first elevation value, the second elevation value and the level of the first map tile in a header file of a preset first storage file; When it is determined that the elevation difference is greater than a first threshold, it is determined that the first quantized elevation difference needs to be stored using two bytes, and a first storage state value for identifying the number of bytes required to store the first quantized elevation difference is stored in a preset first single-byte array; When it is determined that the elevation difference is less than or equal to the first threshold, it is determined that the second quantized elevation difference needs to be stored using one byte, and a second storage state value for identifying the number of bytes required to store the second quantized elevation difference is stored in a preset first single-byte array.
8. A terminal device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the method for processing elevation data according to any one of claims 1 to 6 is implemented.
9. A storage medium, characterized in that: The storage medium includes a stored computer program, wherein when the computer program is executed, the device where the storage medium is located is controlled to execute the elevation data processing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method for storing and reading altitude data of terrain
CN103678657A
Airborne digital topographic data compression method for low altitude penetration
CN104156991A