A Method for Block Terrain Feature Index Storage and Reading of DEM Raster Data
By storing DEM raster data in blocked terrain feature indexing, the problem of low storage and reading efficiency of large-scale DEM data files is solved, efficient data compression and rapid reading are achieved, storage equipment costs and network transmission needs are reduced, and system operation efficiency is improved.
Patent Information
- Application Number
- CN202311214401.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-20
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2043-09-20
AI Technical Summary
The storage and reading efficiency of large-scale DEM data files is low, resulting in high cost of storage devices, large network transmission traffic, and slow system response.
The block terrain feature index storage method is used to re-divid DEM raster data into blocks of row a column b, calculate the average height value and height offset value of each block, and establish a block terrain feature data list and index list, and only the average value and index number of the block index list and terrain feature data are stored.
It significantly reduces the amount of data storage, saves storage equipment costs, improves network transmission efficiency, and maintains rapid efficiency when reading pixel height data, reduces the number of file IO processing times, and improves the processing speed of the software system.
Smart Images

Figure CN117171376B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of raster data processing, and particularly to a method for block terrain feature index storage and reading of DEM raster data. Background Art
[0002] DEM (Digital Elevation Model) is an important original data for studying and analyzing terrain, watershed, and feature recognition. Since DEM can reflect local terrain features at a certain resolution, a large amount of surface morphology information can be extracted through DEM, which can be used to draw contour lines, slope maps, aspect maps, three-dimensional perspective views, three-dimensional landscape maps, and applied to the production of orthophotos, three-dimensional terrain models, and map revision surveys. It has a wide range of applications in the fields of national economy and national defense construction such as surveying and mapping, hydrology, meteorology, geomorphology, geology, soil, engineering construction, communication, and military, as well as in the fields of humanities and natural sciences.
[0003] With the rapid development of satellite remote sensing and hardware technology, the acquired DEM data has higher and higher precision, and the corresponding DEM data files are getting larger and larger. Especially for DEM data with a precision of 5 meters or higher, DEM data files of several hundred GB or even larger are often encountered in many application software, which will increase a series of problems such as the cost of storage devices, network transmission traffic, and slow system response caused by a large amount of data reading and writing of software. The present invention aims to solve the problem of how to efficiently compress and store and quickly read larger DEM data files. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method for block terrain feature index storage and reading of DEM raster data, which can greatly reduce the data storage volume, save the cost of storage devices, improve the network transmission efficiency, and maintain a relatively fast efficiency when reading pixel height data.
[0005] The technical solution of the present invention to solve the above technical problems is as follows:
[0006] In the first aspect, the present invention provides a method for block terrain feature index storage of DEM raster data. The original DEM raster data Data includes M rows and N columns of pixels. Storing the original DEM raster data Data includes the following steps:
[0007] Step 110. Redivide the rows and columns of the original DEM raster data Data to obtain a block data of a rows and b columns;
[0008] Redivide the rows and columns of the original DEM raster data Data composed of M rows and N columns of pixels in units of r rows and c columns of pixels per block, and obtain a blocks of a rows and b columns;
[0009] When M / r is an integer, a = M / r;
[0010] When M / r is not an integer, a = [M / r] + 1;
[0011] When N / c is an integer, b = N / c;
[0012] When N / c is not an integer, b = [N / c] + 1;
[0013] Step 120. For the a×b blocks, dynamically establish a block terrain feature data list and a block index list;
[0014] Calculate the terrain feature data of the a×b blocks. The terrain feature data refers to the average height value of the r×c pixels in the block as the reference, and calculate the height offset value of the r×c pixels in the block;
[0015] Establish a block terrain feature data list according to the terrain feature data;
[0016] Establish an index number for the terrain feature data of the block in the block terrain feature data list, and establish a block index list according to the average height value of the block and the index number of the terrain feature data of the block in the block terrain feature data list;
[0017] Step 130. Store the block index list into the data file Xdata;
[0018] Step 140. Store the block terrain feature data list into the data file Xfeature;
[0019] Step 150. Store the metadata information of the original dem raster data Data, and store the metadata information in the data file meta.
[0020] Further, in the step 120, for the a×b blocks, dynamically establishing a block terrain feature data list and a block index list specifically includes the following steps:
[0021] For the block in the first row and the first column:
[0022] Calculate the terrain feature data of the current block: Traverse all pixel values in the block to obtain the pixel average value Vmean1; for each pixel value V in the block, calculate the relative height offset value delt1 = (V - Vmean1), and obtain r*c height offset values delt1;
[0023] At this time, the number of the list of block terrain feature data is 0, and a terrain feature data is newly added. The added terrain feature data is the r*c calculated height change values delt1. At this time, the number of terrain feature data in the list of block terrain feature data is 1; an element is also added to the block index list, and the value is <average value Vmean1, index number 1>;
[0024] For the block in the first row and the second column:
[0025] Calculate the terrain feature data of the current block: traverse all pixel values in this block to obtain the pixel average value Vmean2; for each pixel value V in the block, calculate the relative height offset value delt2 = (V - Vmean2) to obtain r*c height offset values delt2;
[0026] Compare the terrain feature data of the previous block with the terrain feature data in the list of block terrain feature data and calculate the average error ErrorMean;
[0027] If the average error ErrorMean is less than the maximum average error threshold maxMeanError, then the terrain feature data of the current block coincides with the terrain feature data of the index number index1 in the list of block terrain feature data, and the terrain feature data of the current block is not stored; according to the pixel average value Vmean2 of the current block and the index number index1 of the terrain feature data of the current block in the list of block terrain feature data, add a value <average value Vmean2, index number index1> to the block index list, thereby completing the dynamic processing of this block;
[0028] If the average error ErrorMean is not less than the maximum average error threshold maxMeanError parameter condition, then make a judgment at this time:
[0029] When the number of terrain feature data in the list of block terrain feature data < the maximum index number MaxCount, add the terrain feature data of the current block, that is, the r*c calculated height offset values delt2, and the number of terrain feature data in the list of block terrain feature data increases by 1. At this time, the number of terrain feature data is m; an element is also added to the block index list, and the value of the element is <average value Vmean2, index number m>;
[0030] When the number of the block terrain feature data in the block terrain feature data list = the maximum index number MaxCount, the block terrain feature data list will no longer add block terrain feature data. Traverse the block terrain feature data in the MaxCount block terrain feature data lists, and calculate the index number index2 of the one with the smallest selected average error value ErrorMean; add a value to the block index list, and the value is <Vmean2, index number index2>;
[0031] Process in the same way as the block in the second column of the first row until the block in the ath row and bth column.
[0032] Further, the calculation method of the average error ErrorMean is as follows: for the r*c height offset values deltM of the current block and the r*c height offset values deltS of a certain block terrain feature data, calculate the absolute value of the difference between the height offset values of the two respectively to obtain r*c absolute error values, accumulate and sum them, and then divide by r*c to obtain the average error ErrorMean.
[0033] Further, the metadata information includes: the number of rows M and the number of columns N of the original dem raster data Data; the r value and c value of the block size; the maximum number of terrain feature data MaxCount, and the maximum average error threshold maxMeanError.
[0034] In a second aspect, the present invention provides a method for reading the block terrain feature index of dem raster data, which is used to read the raster data according to the block terrain feature index storage method of dem raster data described in the first aspect, and includes the following steps:
[0035] Step 210. Read the stored metadata information to obtain the number of rows M and the number of columns N of the original dem raster data Data; the r value and c value of the block size, the maximum number of terrain feature data MaxCount, and the maximum average error threshold maxMeanError;
[0036] Step 220. Divide the original dem raster data Data in units of r rows and c columns of pixels per block, and obtain a×b blocks;
[0037] Step 230. Read the data file Xfeature in sequence to obtain the block terrain feature data list;
[0038] Step 240. Read all the block data by reading the data file Xdata in sequence, that is, obtain the block index list data, which has a×b elements, and each element includes the pixel average value Vmean and the index number index;
[0039] Step 250. For a certain block of data, query the list of block terrain feature data according to the index number to obtain the height offset value delt of the block, and calculate the sum of delt and Vmean, which is the final height value of the pixels in the block.
[0040] Compared with the prior art, the present invention has the following technical effects:
[0041] (1) In the present invention, although the calculation amount in the process of generating the dynamic block terrain feature data list and the block index list of the original dem data is relatively large, this can be completed by distributed multi-node collaboration. For an actual software system, it is an offline data preparation process and does not affect the processing efficiency during software operation.
[0042] (2) The present invention uses maxMeanError to control the accuracy of the terrain feature data, and uses a maximum of MaxCount types of terrain feature data to record the trend of these terrain height changes; when storing the dem data, for each pixel in the block, only the average height value and the index number of the pixels in the block need to be recorded. When reading the pixel data of the block, only the height offset value obtained according to the index number plus the average height value is the final pixel height value; in this way, on the basis of ensuring a certain data accuracy, the data storage space can be greatly reduced, and for an actual application software system, the storage device cost and network transmission bandwidth resources can be effectively reduced, and the system operation efficiency can be improved, which has high practical application value.
[0043] (3) In the present invention, when reading the Xdata data file and the Xfeature data file, the data volume is greatly reduced, effectively reducing the number of file I / O processes, and obtaining the pixel height value only requires querying the index data and calculating the sum of a numerical offset, and the calculation amount is very small, which can greatly improve the processing speed of the software system. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0045] Figure 1 It is a schematic flow chart of a method for storing block terrain feature indexes of dem raster data according to the present invention;
[0046] Figure 2 It is a schematic flow chart of a method for reading block terrain feature indexes of dem raster data according to the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0047] In order to further elaborate on the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following will, in conjunction with the accompanying drawings and preferred embodiments, detail the specific implementation manners, structures, features and their effects of the technical solutions proposed according to the present invention. The specific features, structures or characteristics in one or more embodiments can be combined in any suitable form. Unless otherwise defined, all technical and scientific terms used in the present invention have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs.
[0048] In one embodiment of the present invention, referring to Figure 1 , a method for storing a block terrain feature index of DEM raster data is provided. It is assumed that the original DEM raster data Data includes M rows and N columns of pixels, and the numerical type of each pixel is of double type, or it can also be of float type. For the sake of convenient expression, the more typical double type is taken as an example.
[0049] Step 110. Redivide the rows and columns of the original DEM raster data Data to obtain a block data of a rows and b columns;
[0050] The rows and columns of the original DEM raster data Data composed of M rows and N columns of pixels are redivided in units of r rows and c columns of pixels as the block size, and a block data of a rows and b columns is obtained;
[0051] When M / r is an integer, a = M / r;
[0052] When M / r is not an integer, a = [M / r] + 1; at this time, there are less than r rows of pixels in the a-th row block, then the pixel values of the last row are copied to supplement to r rows of pixels.
[0053] When N / c is an integer, b = N / c;
[0054] When N / c is not an integer, b = [N / c] + 1; at this time, there are less than c columns of pixels in the b-th column block, then the pixel values of the last column are copied to supplement to c columns of pixels.
[0055] Step 120. For the block data of a rows and b columns, dynamically establish a block terrain feature data list and a block index list.
[0056] The block terrain feature data list is an array, and each element in the array corresponds to the terrain feature data of r rows and c columns of pixels; among them, the terrain feature data refers to the height offset value calculated based on the average height value of r rows and c columns of pixels in the block, that is, the terrain change trend value, and its physical meaning can be understood as the terrain change feature data of this block, such as a terrain with a gradually gentle uphill terrain where it is lower in the west and higher in the east, etc.
[0057] After analyzing a large amount of DEM data, the following conclusion is obtained: within a certain regional range, in the pixel range of the divided block with r rows and c columns defined above, the number of terrain change characteristics is limited. For example, 100 divided-block terrain feature data can be used to describe various uphill terrain situations with different degrees of low in the west and high in the east; 150 divided-block terrain feature data can be used to describe various terrain situations with different degrees of convexity in the center and flat surroundings, etc. Therefore, a certain number of divided-block terrain feature data need to be stored. Here, a parameter value MaxCount is introduced to represent the maximum number of divided-block terrain feature data stored, that is, the maximum number of elements in the dynamically established terrain feature data list is limited to MaxCount.
[0058] To describe the accuracy of the divided-block terrain feature data, a parameter value maxMeanError is introduced as the maximum average error threshold. Through this parameter value, the number of elements in the dynamically established divided-block terrain feature data list can be controlled. The larger the maxMeanError, the fewer the number of elements in the obtained divided-block terrain feature data list; the smaller the maxMeanError, the larger the number of elements in the obtained divided-block terrain feature data list.
[0059] The divided-block index list is also an array, and each of its elements corresponds to two values, namely the average pixel height meanV of the block and the index number index of the terrain feature of the block in the divided-block terrain feature data list. The index number starts counting from 1, and <average value meanV, index number index> is used to represent the value. Generally, meanV is stored using the floating-point type, and index is stored using the integer type.
[0060] In this embodiment, for each of the a×b divided blocks, the terrain feature data of the current block is calculated in sequence from top to bottom and from left to right. The specific steps are as follows:
[0061] For the divided block in the first row and the first column:
[0062] Calculate the terrain feature data of the current block: traverse all pixel values in the block to obtain the average pixel value Vmean1; for each pixel value V1 in the block, calculate the relative height offset value delt1 = (V1 - Vmean1) to obtain r×c height offset values delt1;
[0063] At this time, the number of the divided-block terrain feature data list is 0, and a new terrain feature data is added. The added terrain feature data is the r×c height change values delt1 calculated. At this time, the number of terrain feature data in the divided-block terrain feature data list is 1; an element is also added to the divided-block index list, and the element value is <average value Vmean1, index number 1>;
[0064] For the block in the first row and second column:
[0065] Calculate the terrain feature data of the current block: Traverse all pixel values in this block to obtain the pixel average value Vmean2; for each pixel value V2 in the block, calculate the relative height offset value delt2 = (V2 - Vmean2), and obtain r*c height offset values delt2.
[0066] At this time, when the number of terrain feature data in the block terrain feature data list > 0, compare the error one by one between the terrain feature data of the previous block and each terrain feature data in the block terrain feature data list:
[0067] If the average error ErrorMean is less than the maximum average error threshold maxMeanError parameter condition, then the terrain feature data of this block coincides with the terrain feature data of the index number index1 in the block terrain feature data list. Therefore, there is no need to store the terrain feature data of this block. Only need to add an element in the block index list, and the element value is <average value Vmean2, index number index1>, thus completing the dynamic processing of this block;
[0068] If the average error ErrorMean is not less than the maximum average error threshold maxMeanError parameter condition, then make a judgment at this time:
[0069] When the number of block terrain feature data in the block terrain feature data list < the maximum index number MaxCount, add a new terrain feature data, and its data is the r*c height offset values delt2 calculated. In this way, the number of terrain feature data in the block terrain feature data list increases by 1, and the number at this time is m. Add an element in the block index list, and the value is <average value Vmean2, index number m>.
[0070] When the number of block terrain feature data in the block terrain feature data list = the maximum index number MaxCount, the block terrain feature data list no longer adds elements. The terrain feature of this block is traversed from these MaxCount block terrain feature data, and calculate and select the index data index2 with the smallest average error value ErrorMean. Add an element in the block index list, and the value is <average value Vmean2, index number index2>.
[0071] In a specific embodiment, for the calculation of the average error ErrorMean, for the r*c height offset values deltM of the current block and the r*c height offset values deltS of the terrain feature data of a certain block, the absolute values of the differences between the height offset values of the two are calculated respectively to obtain r*c absolute error values. The sum is accumulated and divided by r*c to obtain the average error ErrorMean.
[0072] For the block in the first row and the third column: The processing method is the same as above......
[0073] For the block in the a-th row and the b-th column: The processing method is the same as above.
[0074] Step 130. Store the block data into the data file Xdata.
[0075] Perform data storage processing on the original dem data block by block. At this time, only the block index list data needs to be stored. Generally, the double type is used to store the average height Vmean of the elements in the block index list, and the index number index is stored using an integer. In particular, when the maximum index number MaxCount < 65536, the 2-byte unsigned short type integer is used for storage; when the maximum index number MaxCount < (2 to the 32nd power), the 4-byte unsigned int type integer is used for storage; in most applications, the maximum index number MaxCount is less than 65536. Or rather, in most applications, using the feature data of more than 60,000 local terrains is sufficient to describe various existing actual terrains.
[0076] Assume that all block data is stored into the data file Xdata. It can be seen that the storage compression rate of this method is very high. For a block with r = c = 10, the ordinary method requires 800 bytes of storage space to store the pixel data of this block, while this method only requires 10 bytes of storage space when MaxCount < 65536.
[0077] Step 140. Store the list of block terrain feature data into the data file Xfeature;
[0078] The maximum storage space required is r*c*8*MaxCount bytes. For a block with r = c = 10, when MaxCount takes 65535, the maximum only requires 50MB of storage space. Of course, for the dem data of a local area, the list of block terrain feature data usually only requires a smaller number of index data to describe various terrains.
[0079] Step 150. Store the metadata information of the original dem raster data Data and store the metadata information in the data file meta.
[0080] The metadata information includes: the number of rows M and the number of columns N of the original DEM raster data Data; the block size r value, c value, the maximum number of terrain feature data MaxCount, the maximum average error threshold maxMeanError, etc. Write this metadata information into the data file meta.
[0081] Based on the above method for storing the block terrain feature index of a DEM raster data, refer to Figure 2 , the present invention also provides a method for reading the block terrain feature index of a DEM raster data. The specific reading process is as follows:
[0082] Step 210. Read the data file meta to obtain the metadata information of the original DEM raster data Data.
[0083] The number of rows M and the number of columns N of the original DEM raster data Data; the block size r value, c value, the maximum number of terrain feature data MaxCount, the maximum average error threshold maxMeanError, etc.
[0084] Step 220. Divide the original DEM raster data Data with a block size of r rows and c columns of pixels as a unit, and finally divide it into a rows and b columns of blocks;
[0085] Step 230. Read the data file Xfeature in sequence to obtain the list of block terrain feature data.
[0086] Step 240. Read the data file Xdata in sequence to obtain all block data, that is, obtain the block index list data, which has a rows and b columns of elements. Each element includes the pixel average value Vmean and the index number index; for a certain block data, query the list of block terrain feature data according to the index number index to obtain the height offset value delt of the block, and calculate the sum of delt and Vmean as the final height value of the pixels of the block.
[0087] Typically, the block size can take the block area size of r = 16 rows and c = 16 columns of pixels, and the maximum index number MaxCount can take 65535; the larger the value of MaxCount, the larger the capacity of the stored block terrain feature data, the richer the terrain change features that can be stored, the more element data in the list of block terrain feature data, and the larger the storage space required; the smaller the value of maxMeanError, the higher the precision of the stored block terrain feature data, the larger the storage space required, and the smaller the data error; for applications with low precision requirements, the maxMeanError parameter can take 5.0; for applications with high precision requirements, the maxMeanError parameter can take 0.5 or smaller.
[0088] This method takes into account the characteristics of DEM data: even in the case of a large amount of DEM data, the trend of terrain height change within a local range is always limited. For example, for the national terrain height data with a resolution of 1 meter, within a range of 10 * 10 square meters, the terrain height change characteristics generally include overall flat, higher on the left and lower on the right, lower on the left and higher on the right, higher in the middle and lower around, lower in the middle and higher around, etc. And through statistics, it is found that there are a large number of approximate phenomena in the terrain height change characteristics within a local area, and the number of terrain height change characteristics is limited within a certain error range. Therefore, maxMeanError is used to control the accuracy of terrain feature data, and the terrain height change trend is recorded with terrain feature data of up to MaxCount types; when storing DEM data, for each pixel in a block, only the average pixel height and index number of this block need to be recorded. When reading the pixel data of this block, only the height offset value delt of this pixel is obtained according to the index number and added to the average height to get the final pixel height value. In this way, on the basis of ensuring a certain data accuracy, the data storage space can be greatly reduced, the storage device cost and network transmission bandwidth resources of the actual application software system can be effectively reduced, the system operation efficiency can be improved, and it has high practical application value.
[0089] Taking the national DEM data as an example, in the case of a 30 - meter resolution, the traditional storage method consists of M = 134724 rows and N = 161360 column raster pixel data, and is stored using 8 - byte double - type numerical values, with a total storage space required of approximately 161.9 GB.
[0090] Applying this method, a divided area of 16×16 pixels is used for division to obtain a = 8421 and b = 10085 divided blocks. Then, for these a * b blocks, a list of block terrain feature data and a block index list are dynamically established according to the above method. Under the condition that the maximum index number MaxCount is taken as 65535 and the maxMeanError parameter is taken as 3.0 meters, the data of the block index list is stored in the data file Xdata, and the storage size of the obtained data file Xdata is approximately 810 MB; the list of block terrain feature data is stored in the data file Xfeature. The actual number of stored block terrain feature data is 42318, and the required storage space is 42318 * 16×16 * 8 bytes, approximately 83 MB. The metadata information storage space of the original DEM raster data Data can be ignored. The total storage space of this method is less than 900 MB, less than 0.6% of the original data storage size, and it also maintains a certain data accuracy. At the same time, when reading and calculating the pixel height value, the efficiency of this method is also very high, only requiring a simple addition operation; therefore, it can be seen that this method greatly saves the storage space, and the data compression effect is significantly better than other existing methods.
[0091] The method for block terrain feature indexing storage and reading of DEM grid data in the present invention has the following advantages: it has a high data compression rate on the basis of maintaining a certain data accuracy; although the calculation amount in the generation process of the dynamic block terrain feature data list and the block index list of the original DEM data is relatively large, this can be completed by distributed multi-node collaboration. For an actual software system, it is an offline data preparation process and does not affect the processing efficiency during software operation. When the software system runs, it reads the Xdata data file and the Xfeature data file processed by this method. The data volume is greatly reduced, effectively reducing the number of file I / O processing times. Moreover, obtaining the pixel height value only requires querying the index data and calculating the sum of a numerical offset, and the calculation amount is very small, which can greatly improve the processing speed of the software system.
[0092] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for storing a block terrain feature index of DEM raster data. The original DEM raster data Data includes M rows and N columns of pixels. When storing the original DEM raster data Data, it is characterized in that, It includes the following steps: Step 110. Redivide the rows and columns of the original dem raster data Data to obtain a×b sub-block data; Redivide the rows and columns of the original dem raster data Data composed of M×N pixels in units of r×c pixels per block, and a×b sub-blocks are obtained; When M / r is an integer, a = M / r; When M / r is not an integer, a = [M / r]+1; When N / c is an integer, b = N / c; When N / c is not an integer, b = [N / c]+1; Step 120. For the a×b sub-blocks, dynamically establish a sub-block terrain feature data list and a sub-block index list; Calculate the terrain feature data of the a×b sub-blocks. The terrain feature data refers to calculating the height offset value of the r×c pixels in the sub-block based on the average height value of the r×c pixels in the sub-block; Establish a sub-block terrain feature data list according to the terrain feature data; Establish an index number for the terrain feature data of the sub-block in the sub-block terrain feature data list, and establish a sub-block index list according to the average height value of the sub-block and the index number of the terrain feature data of the sub-block in the sub-block terrain feature data list; Step 130. Store the sub-block index list into the data file Xdata; Step 140. Store the sub-block terrain feature data list into the data file Xfeature; Step 150. Store the metadata information of the original dem raster data Data, and store the metadata information in the data file meta.
2. The block terrain feature index storage method for dem grid data according to claim 1, characterized in that In step 120, for the a×b sub-blocks, dynamically establishing a sub-block terrain feature data list and a sub-block index list specifically includes the following steps: For the sub-block in the first row and the first column: Calculate the terrain feature data of the current block: Traverse all pixel values in the sub-block to obtain the pixel average value Vmean1; for each pixel value V in the sub-block, calculate the relative height offset value delt1=(V - Vmean1) to obtain r*c height offset values delt1; At this time, the number of the sub-block terrain feature data list is 0, and a new terrain feature data is added. The added terrain feature data is the r*c height change values delt1 calculated. At this time, the number of terrain feature data in the sub-block terrain feature data list is 1; an element is also added to the sub-block index list, and the value is <average value Vmean1, index number 1>; For the sub-block in the first row and the second column: Calculate the terrain feature data of the current block: Traverse all pixel values in the sub-block to obtain the pixel average value Vmean2; for each pixel value V in the sub-block, calculate the relative height offset value delt2=(V - Vmean2) to obtain r*c height offset values delt2; Compare the terrain feature data of the previous sub-block with the terrain feature data in the sub-block terrain feature data list, and calculate the average error ErrorMean; If the average error ErrorMean is less than the maximum average error threshold maxMeanError, the terrain feature data of the current block matches the terrain feature data of the index number index1 in the list of block terrain feature data, and the terrain feature data of the current block is not stored; according to the pixel average value Vmean2 of the current block and the index number index1 of the current block terrain feature data in the list of block terrain feature data, add a value <average value Vmean2, index number index1> to the block index list, thereby completing the dynamic processing of this block; If the average error ErrorMean is not less than the maximum average error threshold maxMeanError parameter condition, at this time, judge: When the number of block terrain feature data in the list of block terrain feature data < the maximum index number MaxCount, add the terrain feature data of the current block, that is, calculate the r*c height offset values delt2, and the number of terrain feature data in the list of block terrain feature data increases by 1. At this time, the number of terrain feature data is m; add an element to the block index list, and the value of the element is <average value Vmean2, index number m>; When the number of block terrain feature data in the list of block terrain feature data = the maximum index number MaxCount, the list of block terrain feature data no longer adds block terrain feature data. Traverse the block terrain feature data in the list of MaxCount block terrain feature data, and calculate and select the index number index2 with the smallest average error value ErrorMean; add a value to the block index list, and the value is <Vmean2, index number index2>; Process the blocks from the first row and second column to the a-th row and b-th column in the same way as the block in the first row and second column.
3. The method for storing the indexed terrain features of DEM raster data in blocks according to claim 2, wherein, The calculation method of the average error ErrorMean is as follows: for the r*c height offset values deltM of the current block and the r*c height offset values deltS of the terrain feature data of a certain block, calculate the absolute value of the difference between the height offset values of the two respectively to obtain r*c absolute error values, sum them up cumulatively and divide by r*c to obtain the average error ErrorMean.
4. A method for indexing and storing block terrain features of dem raster data according to claim 1, characterized in that, The metadata information includes: the number of rows M and the number of columns N of the original dem raster data Data; the r value and c value of the block size; the maximum number of terrain feature data MaxCount and the maximum average error threshold maxMeanError.
5. A method for reading the block terrain feature index of DEM raster data, which is used to read the raster data of the block terrain feature index storage method of DEM raster data according to any one of claims 1-4, characterized in that, It includes the following steps: Step 210. Read the stored metadata information to obtain the number of rows M and the number of columns N of the original dem raster data Data; the r value and c value of the block size, the maximum number of terrain feature data MaxCount and the maximum average error threshold maxMeanError; Step 220. Divide the original dem raster data Data in units of r rows and c columns of pixels, and divide it into a rows and b columns of blocks; Step 230. Read the data file Xfeature in sequence to obtain the list of block terrain feature data; Step 240. Read the data file Xdata sequentially to obtain all the block data, that is, obtain the block index list data, which has a total of a rows and b columns of elements. Each element includes the pixel average value Vmean and the index number index; Step 250. For a certain block of data, query the block terrain feature data list according to the index number to obtain the height offset value delt of this block, and calculate the sum of delt and Vmean, which is the final height value of the pixels in this block.
Citation Information
Patent Citations
Map construction method based on unreal engine, electronic equipment and storage medium
CN115409957A
Thermodynamic diagram construction method based on unreal engine, electronic equipment and storage medium
CN115409961A