[go: up one dir, main page]

CN114238471A - Terrain data conversion method and device, electronic equipment and storage medium - Google Patents

Terrain data conversion method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114238471A
CN114238471A CN202111505311.XA CN202111505311A CN114238471A CN 114238471 A CN114238471 A CN 114238471A CN 202111505311 A CN202111505311 A CN 202111505311A CN 114238471 A CN114238471 A CN 114238471A
Authority
CN
China
Prior art keywords
value
pseudo
data
elevation
elevation value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111505311.XA
Other languages
Chinese (zh)
Other versions
CN114238471B (en
Inventor
冯肇勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Xaircraft Technology Co Ltd
Original Assignee
Guangzhou Xaircraft Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Xaircraft Technology Co Ltd filed Critical Guangzhou Xaircraft Technology Co Ltd
Priority to CN202111505311.XA priority Critical patent/CN114238471B/en
Publication of CN114238471A publication Critical patent/CN114238471A/en
Application granted granted Critical
Publication of CN114238471B publication Critical patent/CN114238471B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2291User-Defined Types; Storage management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/29Geographical information databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Remote Sensing (AREA)
  • Processing Or Creating Images (AREA)
  • Image Processing (AREA)

Abstract

本发明实施例提出一种地形数据转换方法、装置、电子设备和存储介质,涉及测绘领域。该方法通过读取栅格地形数据中的高程值,将高程值转换为单位是毫米且为正整数的伪高程值,并将伪高程值按照预设的对应关系转换为红绿蓝三个波段的数值,然后根据红绿蓝三个波段的数值将栅格地形数据保存为图片格式的数据。如此,实现了将栅格地形数据以毫米级的精度转换成图片格式的数据,利用图片格式具有的无损压缩技术,可对栅格地形数据进行无损压缩,从而有效降低栅格地形数据的文件大小,降低数据的存储成本,提升数据的传输效率。

Figure 202111505311

The embodiments of the present invention provide a terrain data conversion method, device, electronic device and storage medium, which relate to the field of surveying and mapping. The method reads the elevation value in the raster terrain data, converts the elevation value into a pseudo-elevation value with a unit of millimeter and a positive integer, and converts the pseudo-elevation value into three bands of red, green and blue according to the preset corresponding relationship , and then save the raster terrain data as data in image format according to the values of the three bands of red, green and blue. In this way, the raster terrain data is converted into image format data with millimeter-level precision, and the raster terrain data can be compressed losslessly by using the lossless compression technology of the image format, thereby effectively reducing the file size of the raster terrain data. , reduce data storage costs and improve data transmission efficiency.

Figure 202111505311

Description

Terrain data conversion method and device, electronic equipment and storage medium
Technical Field
The invention relates to the field of surveying and mapping, in particular to a topographic data conversion method and device, electronic equipment and a storage medium.
Background
In the surveying and mapping industry, the topography of a surveying and mapping area is usually recorded in a single-waveband raster image in an aerial photogrammetry result, and the most common raster Digital topography models are DSM (Digital Surface Model) and DEM (Digital Elevation Model), and data is usually stored in a file format of GeoTiff.
DSM refers to a ground elevation model that includes the height of surface buildings, bridges, trees, etc. DEM, which is a kind of solid ground Model that uses a group of ordered numerical value array form to represent the ground elevation, is a branch of DTM (Digital Terrain Model), from which all other Terrain feature values can be derived.
In the prior art, the GeoTiff format is used for DSM data and DEM data, although high-precision topographic data can be well stored, the defect of huge file amount exists, and great difficulties are generated in data storage and data network transmission.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a method and an apparatus for converting topographic data, an electronic device, and a storage medium, so as to solve the problems of the prior art that the amount of topographic data files is large, which further results in high storage cost and low transmission efficiency of data.
In order to achieve the above purpose, the embodiment of the present invention adopts the following technical solutions:
in a first aspect, the present invention provides a method for transforming terrain data, the method comprising:
reading an elevation value in the grid terrain data;
converting the elevation value into a pseudo elevation value; the pseudo elevation value is a positive integer with the unit of millimeter;
converting the pseudo elevation value into numerical values of red, green and blue wave bands according to a preset corresponding relation;
and storing the raster terrain data into data in a picture format according to the numerical values of the red, green and blue wave bands.
In an alternative embodiment, the converting the elevation values into pseudo elevation values includes:
and adding the elevation value in the unit of meter with a preset value, multiplying by 1000, and rounding the multiplied value according to a set first rounding rule to obtain a pseudo elevation value which is in the unit of millimeter and is a positive integer.
In an optional embodiment, the preset corresponding relationship includes a first corresponding relationship, a second corresponding relationship, and a third corresponding relationship;
the converting the pseudo elevation value into the numerical values of red, green and blue three wave bands according to the preset corresponding relation comprises the following steps:
substituting the pseudo elevation value into the first corresponding relation for calculation, and rounding a first result obtained by calculation according to a set second rounding rule to obtain a numerical value of a red waveband;
substituting the pseudo elevation value and the numerical value of the red waveband into the second corresponding relation for calculation, and rounding a second result obtained by calculation according to a second rounding rule to obtain a numerical value of a green waveband;
and substituting the pseudo elevation value, the numerical value of the red waveband and the numerical value of the green waveband into the third corresponding relation for calculation to obtain the numerical value of the blue waveband.
In an alternative embodiment, the expression of the first corresponding relationship is: r1 ═ h/256/256, where h represents the pseudo-elevation value and R1 represents the first result;
the expression of the second correspondence relationship is: g1 ═ h- (R256 × 256))/256, where G1 represents the second result, R represents the value of the red band, and R is rounded by R1 according to a second set rounding rule;
the expression of the third correspondence relationship is: b ═ h- (R × 256) - (G × 256), where B denotes the value of the blue band, G denotes the value of the green band, and G is rounded by G1 according to a second set rounding rule.
In an alternative embodiment, the method further comprises:
and converting numerical values of red, green and blue wave bands in the data in the picture format into elevation values according to a preset conversion relation, so that the data in the picture format is inversely converted into the raster terrain data.
In a second aspect, the present invention provides a terrain data conversion apparatus, the apparatus comprising:
the data reading module is used for reading an elevation value in the grid terrain data;
the first conversion module is used for converting the elevation value into a pseudo elevation value; the pseudo elevation value is a positive integer with the unit of millimeter;
the second conversion module is used for converting the pseudo elevation value into numerical values of red, green and blue wave bands according to a preset corresponding relation;
and the data storage module is used for storing the raster terrain data into data in a picture format according to the numerical values of the red, green and blue wave bands.
In an optional embodiment, the first conversion module is configured to add the elevation value in units of meters to a preset value, then multiply by 1000, and round a value obtained by the multiplication according to a set first rounding rule to obtain a pseudo elevation value in units of millimeters and positive integers.
In an optional embodiment, the preset corresponding relationship includes a first corresponding relationship, a second corresponding relationship, and a third corresponding relationship;
the second conversion module is used for substituting the pseudo elevation value into the first corresponding relation to calculate, and rounding a first result obtained by calculation according to a set second rounding rule to obtain a numerical value of a red waveband; substituting the pseudo elevation value and the numerical value of the red waveband into the second corresponding relation for calculation, and rounding a second result obtained by calculation according to a second rounding rule to obtain a numerical value of a green waveband; and substituting the pseudo elevation value, the numerical value of the red waveband and the numerical value of the green waveband into the third corresponding relation for calculation to obtain the numerical value of the blue waveband.
In a third aspect, the invention provides an electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the terrain data conversion method according to any of the preceding embodiments.
In a fourth aspect, the invention provides a computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, realizes the steps of the terrain data conversion method according to any one of the preceding embodiments.
According to the terrain data conversion method, the device, the electronic equipment and the storage medium provided by the embodiment of the invention, the elevation value is converted into the pseudo elevation value with the unit of millimeter and a positive integer by reading the elevation value in the raster terrain data, the pseudo elevation value is converted into the numerical values of red, green and blue wave bands according to the preset corresponding relation, and then the raster terrain data is stored as the data in the picture format according to the numerical values of the red, green and blue wave bands. Like this, realized converting grid topographic data to the data of picture format with the precision of millimeter level, utilized the lossless compression technique that the picture format has, can carry out lossless compression to grid topographic data to effectively reduce the file size of grid topographic data, reduce the storage cost of data, promoted the transmission efficiency of data.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic flow chart of a method for converting topographic data according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of a terrain data conversion method provided by an embodiment of the invention;
fig. 3 is a schematic flow chart of a terrain data conversion method provided by an embodiment of the invention;
FIG. 4 is a schematic diagram showing the interconversion between elevation values and RGB three band values;
fig. 5 is a functional block diagram of a terrain data conversion apparatus according to an embodiment of the present invention;
fig. 6 is a functional block diagram of a topographic data conversion device according to an embodiment of the present invention;
fig. 7 is a block diagram of an electronic device according to an embodiment of the present invention.
Icon: 500-a terrain data conversion device; 700-an electronic device; 510-a data reading module; 520-a first conversion module; 530-a second conversion module; 540-data saving module; 550-a third conversion module; 710-a memory; 720-a processor; 730-a communication module.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
It is noted that relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
At present, raster terrain data is usually stored in a GeoTiff file format, and high-precision terrain data can be well stored, but the defect of huge file amount exists, and great problems are generated in data storage and data network transmission.
In view of this, embodiments of the present invention provide a topographic data conversion method, an apparatus, an electronic device, and a storage medium, which are capable of converting raster topographic data into data in a picture format with millimeter-scale accuracy, and performing lossless compression on the raster topographic data by using a lossless compression technique in the picture format, so as to effectively reduce the file size of the raster topographic data, reduce the storage cost of the data, and improve the transmission efficiency of the data.
Next, a detailed description will be given of a method for converting topographic data according to an embodiment of the present invention.
Fig. 1 is a schematic flow chart of a method for converting topographic data according to an embodiment of the present invention. It should be noted that the method for converting terrain data according to the embodiment of the present invention is not limited by fig. 1 and the following specific sequence, and it should be understood that, in other embodiments, the sequence of some steps in the method for converting terrain data according to the embodiment of the present invention may be interchanged according to actual needs, or some steps may be omitted or deleted. The specific process shown in FIG. 1 will be described in detail below.
And step S101, reading the elevation value in the grid terrain data.
In this embodiment, the raster terrain data may be DSM data or DEM data, which records the topography of the surveying area, from which elevation values may be read.
Step S102, converting elevation values into pseudo elevation values; the pseudo elevation values are positive integers in millimeters.
In this embodiment, the elevation value is usually in meters, and in order to realize the conversion of the grid terrain data with higher precision, after the elevation value is read, the elevation value can be converted into a pseudo elevation value which is in millimeters and is a positive integer, so that the data conversion can be realized with the precision of millimeter.
And step S103, converting the pseudo elevation value into the numerical values of red, green and blue wave bands according to a preset corresponding relation.
In this embodiment, the pseudo-elevation value may be converted into three values according to a preset corresponding relationship, and the three values are respectively recorded in three bands of RGB (red, green, and blue), so as to obtain the values of the three bands of red, green, and blue. It is understood that the values of the three red, green and blue bands include the values of the red band, the values of the green band and the values of the blue band.
And step S104, storing the raster terrain data into data in a picture format according to the numerical values of the red, green and blue wave bands.
In this embodiment, the picture formats may include PNG, Webp, and the like, and in both the PNG and Webp formats, three RGB bands may exist for recording the color information of the picture, so that after the pseudo-elevation value is converted into the values of the three red, green, and blue bands, the raster terrain data may be stored as the data in the PNG or Webp format according to the values of the three red, green, and blue bands. Because the common picture formats such as PNG, Webp and the like have lossless compression technology, the raster terrain data is stored as the data in the picture format, and lossless compression of the raster terrain data can be realized. For example, 100Mb of GeoTiff data can be compressed to be below 30Mb, the file size of raster terrain data is effectively reduced, the storage cost of the data is reduced, and the data transmission efficiency is increased.
As can be seen, in the method for converting terrain data provided in the embodiment of the present invention, by reading the elevation value in the raster terrain data, the elevation value is converted into a pseudo elevation value with a unit of millimeter and a positive integer, the pseudo elevation value is converted into values of three red, green and blue bands according to a preset corresponding relationship, and then the raster terrain data is stored as data in a picture format according to the values of the three red, green and blue bands. Like this, realized converting grid topographic data to the data of picture format with the precision of millimeter level, utilized the lossless compression technique that the picture format has, can carry out lossless compression to grid topographic data to effectively reduce the file size of grid topographic data, reduce the storage cost of data, promoted the transmission efficiency of data.
In practical application, considering that the current general earth altitude elevation value range is plus or minus 10000 meters, converting a unit into millimeters, the elevation value range is plus or minus 1000 ten thousand millimeters, and all elevation values can be represented by 2000 ten thousand positive integers.
In the picture formats such as PNG and Webp, three RGB bands exist for recording color information of the picture, and the data type of the numerical values of the RGB bands is usually uint8, and at most, positive integer numerical values in the range of 0 to 255 can be recorded, so that in the three RGB bands, the recordable numerical values of each band range from 0 to 255 for 256 numerical values, and the numerical values in the three bands are multiplied to obtain a positive integer, where the range of the positive integer is from 0 to (256 × 16777216), and about 1600 ten thousand positive integer numerical values. Namely, the three bands of RGB can express 1600 ten thousand positive integers.
Therefore, if the elevation range of plus or minus 10000 meters is adopted, 2000 ten thousand values are needed to record in millimeter unit, and the three RGB wave bands can not meet the requirement. Therefore, the embodiment eliminates part of unused elevation value ranges, so that the numerical values in the modified elevation value ranges can be expressed through three RGB wave bands.
Based on this, the step S102 may include: and adding the elevation value in the unit of meter with a preset value, multiplying by 1000, and rounding the value obtained by the multiplication according to a set first rounding rule to obtain a pseudo elevation value which is in the unit of millimeter and is a positive integer.
In this embodiment, the preset value may be determined according to the modified elevation value range.
For example, the range of high values of-6000 meters to-10000 meters, which is hardly used, can be excluded. The highest altitude of the land of the earth is 8844.43 m of Jolmoumare, and the lowest altitude of the land of the earth is 428 m of dead sea. The elevation value recording range of the elevation value is modified from-10000 meters to 10000 meters, the elevation value recording range is modified into a range from-6000 meters to 10000 meters, the elevation value recording range is converted into millimeters, the elevation value recording range is from-600 ten thousand millimeters to 1000 ten thousand millimeters, and 1600 ten thousand positive integer values are obtained.
In the present embodiment, the first rounding rule may be set according to actual requirements, for example, rounding (rounding numbers after decimal points) may be adopted. When the modified height value range is from-6000 m to 10000 m and the pseudo-height value obtained by conversion is a positive integer in mm, the preset value can be set to 6000, when the height value H is converted into the pseudo-height value H, firstly, a formula hm ═ H +6000 × 1000 is used for calculating to obtain hm, then, the formula hm is rounded up to obtain the pseudo-height value H, and the pseudo-height value H is a positive integer in mm.
It can be seen that, in the method for converting terrain data provided in the embodiment of the present invention, in order to enable three RGB bands to express all height values with a precision of millimeter level, part of the height value ranges that are not used are eliminated, and a preset value for pseudo-height value conversion is determined based on the modified height value ranges, after reading out the height values, the height values in units of meters are added to a preset value and multiplied by 1000, and the multiplied values are rounded according to a set first rounding rule, so that pseudo-height values in units of millimeters and positive integers can be obtained, thereby realizing data conversion with a precision of millimeter level.
In an embodiment, the preset corresponding relationship includes a first corresponding relationship, a second corresponding relationship, and a third corresponding relationship, and based on the first corresponding relationship, the second corresponding relationship, and the third corresponding relationship, the value of the red band, the value of the green band, and the value of the blue band may be calculated respectively. As shown in fig. 2, the step S103 may include the following sub-steps:
and a substep S1031, substituting the pseudo elevation value into the first corresponding relation for calculation, and rounding the calculated first result according to a set second rounding rule to obtain a numerical value of a red waveband.
In this embodiment, the first corresponding relationship records the corresponding relationship between the first result and the pseudo-elevation value, and the second rounding rule may also be set according to actual needs, for example, rounding down may be adopted. After the pseudo-elevation value is determined, a first result can be calculated based on the first corresponding relation, and the first result is rounded downwards, so that the numerical value of the red waveband can be obtained.
And a substep S1032 of substituting the pseudo elevation value and the value of the red wave band into a second corresponding relation for calculation, and rounding a second result obtained by calculation according to a second rounding rule to obtain the value of the green wave band.
In this embodiment, the second corresponding relationship records the corresponding relationship between the second result and the pseudo-elevation value and the red waveband value. And when the pseudo elevation value and the red waveband value are determined, calculating a second result based on the second corresponding relation, and rounding the second result downwards to obtain the green waveband value.
And a substep S1033 of substituting the pseudo elevation value, the value of the red waveband and the value of the green waveband into a third corresponding relation for calculation to obtain the value of the blue waveband.
In this embodiment, the third correspondence records the correspondence between the numerical value of the blue wavelength band and the pseudo-elevation value, the numerical value of the red wavelength band, and the numerical value of the green wavelength band. And after the pseudo elevation value, the numerical value of the red waveband and the numerical value of the green waveband are determined, calculating to obtain the numerical value of the blue waveband based on the third corresponding relation.
Therefore, the method for converting terrain data provided by the embodiment of the invention can simply and quickly convert the pseudo-elevation value into the numerical values of the red, green and blue three wave bands by presetting the three corresponding relations (namely the first corresponding relation, the second corresponding relation and the third corresponding relation), and record the color information of the picture by the numerical values of the red, green and blue three wave bands.
In one embodiment, the expression of the first correspondence relationship is: r1 ═ h/256/256, where h denotes the pseudo-elevation value and R1 denotes the first result. The expression of the second correspondence relationship is: g1 ═ h- (R256 × 256))/256, where G1 indicates the second result, R indicates the value of the red band, and R is rounded by R1 according to the second set rounding rule. The expression of the third correspondence relationship is: b ═ h- (R × 256) - (G × 256), where B denotes the value of the blue band, G denotes the value of the green band, and G is rounded by G1 according to a second set rounding rule.
According to the elevation value range defined in this embodiment, the maximum value of the elevation value H is 10000, the minimum value is-6000, the maximum value of the pseudo elevation value H is 1600 ten thousand, and the minimum value is 0, so that the value range of R is 0-244, which proves that the storage ranges of three RGB bands can satisfy all the elevation values with the accuracy of millimeter level.
Optionally, since the picture formats such as PNG and Webp can implement lossless compression, conversion and storage of all data do not destroy the elevation value information, and after the raster terrain data is converted into the picture format data and stored, the picture format data can be reversely converted into the raster terrain data in the GeoTiff format. Based on this, referring to fig. 3, the method for converting terrain data according to the embodiment of the present invention may further include:
step S301, converting the numerical values of red, green and blue wave bands in the data in the picture format into elevation values according to a preset conversion relation, thereby inversely converting the data in the picture format into raster terrain data.
For example, according to the expression B- (R × 256) - (G × 256) of the third correspondence and the conversion process of the elevation value and the pseudo elevation value, the conversion relationship between the elevation value and the values of the red, green, and blue three bands may be set as follows: h ═ ((R × 256) + (G × 256) + B) × 0.001-6000. That is, the value R of the red band, the value G of the green band, and the value B of the blue band in the data of the picture format are substituted into the conversion relationship, so that the elevation value H can be obtained, and the data of the picture format is inversely converted into the raster terrain data.
Therefore, according to the terrain data conversion method provided by the embodiment of the invention, the elevation value in the grid terrain data is read out, then the elevation value is converted to obtain 3 uint8 type numerical values, and the numerical values are respectively recorded in three RGB wave bands, so that the grid terrain data is converted into data in picture formats such as PNG (portable navigation group), Webp (Webp) and the like. Because the lossless compression technology of common picture formats such as PNG or Webp is utilized, the lossless compression of the raster terrain data can be realized, so that the conversion and the storage of all data can not damage the elevation value information, and the inverse conversion of numerical values of three wave bands of RGB into corresponding elevation values is ensured to obtain the raster terrain data. Fig. 4 is a schematic diagram illustrating the interconversion between the elevation value and the RGB three-band value.
In order to perform the corresponding steps in the above embodiments and various possible manners, an implementation manner of the topographic data conversion device is given below. Referring to fig. 5, a functional block diagram of a terrain data conversion apparatus 500 according to an embodiment of the invention is shown. It should be noted that the basic principle and the technical effects of the topographic data conversion device 500 provided in the present embodiment are the same as those of the above embodiments, and for the sake of brief description, no part of the present embodiment is mentioned, and corresponding contents in the above embodiments may be referred to. The topographic data conversion device 500 includes a data reading module 510, a first conversion module 520, a second conversion module 530, and a data storage module 540.
The data reading module 510 is configured to read an elevation value in the grid terrain data.
It is understood that the data reading module 510 can perform the above step S101.
The first conversion module 520 is configured to convert the elevation values into pseudo elevation values; the pseudo elevation values are positive integers in millimeters.
It is understood that the first conversion module 520 may perform the step S102.
The second conversion module 530 is configured to convert the pseudo-elevation value into values of three bands, red, green and blue, according to a preset corresponding relationship.
It is understood that the second conversion module 530 can perform the step S103.
The data storage module 540 is configured to store the raster terrain data as data in a picture format according to the values of the red, green and blue bands.
It is understood that the data saving module 540 may perform the step S104.
Optionally, the first conversion module 520 may be specifically configured to add the elevation value in units of meters to a preset value, then multiply by 1000, and round the value obtained by the multiplication according to a set first rounding rule to obtain a pseudo elevation value in units of millimeters and positive integers.
Optionally, the preset corresponding relationship includes a first corresponding relationship, a second corresponding relationship and a third corresponding relationship; the second conversion module 530 may be specifically configured to substitute the pseudo elevation value into the first corresponding relationship to perform calculation, and perform rounding on a first result obtained by the calculation according to a set second rounding rule to obtain a value of a red band; substituting the pseudo elevation value and the numerical value of the red waveband into a second corresponding relation for calculation, and rounding a second result obtained by calculation according to a second rounding rule to obtain a numerical value of the green waveband; and substituting the pseudo elevation value, the numerical value of the red waveband and the numerical value of the green waveband into a third corresponding relation for calculation to obtain the numerical value of the blue waveband.
It is to be understood that the second conversion module 530 can perform the sub-steps S1031 to S1033 described above.
Optionally, the expression of the first corresponding relationship is: r1 ═ h/256/256, where h denotes the pseudo-elevation value and R1 denotes the first result. The expression of the second correspondence relationship is: g1 ═ h- (R256 × 256))/256, where G1 indicates the second result, R indicates the value of the red band, and R is rounded by R1 according to the second set rounding rule. The expression of the third correspondence relationship is: b ═ h- (R × 256) - (G × 256), where B denotes the value of the blue band, G denotes the value of the green band, and G is rounded by G1 according to a second set rounding rule.
Optionally, referring to fig. 6, the terrain data conversion apparatus 500 according to the embodiment of the present invention may further include a third conversion module 550, where the third conversion module 550 may be configured to convert the values of the red, green, and blue bands in the data in the picture format into altitude values according to a preset conversion relationship, so as to inversely convert the data in the picture format into the raster terrain data.
It is understood that the third converting module 550 can perform the step S301.
Therefore, in the topographic data conversion device provided by the embodiment of the invention, the elevation value in the grid topographic data is read through the data reading module, and the elevation value is converted into the pseudo elevation value through the first conversion module; the unit of the pseudo elevation value is a positive integer of millimeter, the second conversion module converts the pseudo elevation value into numerical values of red, green and blue wave bands according to a preset corresponding relation, and the data storage module stores the raster terrain data into data in a picture format according to the numerical values of the red, green and blue wave bands. Like this, realized converting grid topographic data to the data of picture format with the precision of millimeter level, utilized the lossless compression technique that the picture format has, can carry out lossless compression to grid topographic data to effectively reduce the file size of grid topographic data, reduce the storage cost of data, promoted the transmission efficiency of data.
Fig. 7 is a block diagram of an electronic device 700 according to an embodiment of the invention. Electronic device 700 includes memory 710, processor 720, and communication module 730. The elements of the memory 710, processor 720 and communication module 730 are electrically connected to each other, directly or indirectly, to enable the transfer or interaction of data. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
The memory 710 is used for storing programs or data. The Memory 710 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like.
The processor 720 is used to read/write data or programs stored in the memory 710 and perform corresponding functions. For example, when the computer program stored in the memory 710 is executed by the processor 720, the terrain data conversion method disclosed in the above embodiments may be implemented.
The communication module 730 is used for establishing a communication connection between the electronic device 700 and another communication terminal through a network, and for transceiving data through the network.
It should be understood that the configuration shown in fig. 7 is merely a schematic diagram of the configuration of the electronic device 700, and that the electronic device 700 may include more or fewer components than shown in fig. 7, or have a different configuration than shown in fig. 7. The components shown in fig. 7 may be implemented in hardware, software, or a combination thereof.
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by the processor 720, implements the method for converting terrain data disclosed in the above embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1.一种地形数据转换方法,其特征在于,所述方法包括:1. a terrain data conversion method, is characterized in that, described method comprises: 读取栅格地形数据中的高程值;Read elevation values in raster terrain data; 将所述高程值转换为伪高程值;所述伪高程值为单位是毫米的正整数;converting the elevation value into a pseudo-elevation value; the pseudo-elevation value is a positive integer with a unit of millimeter; 将所述伪高程值按照预设的对应关系转换为红绿蓝三个波段的数值;Converting the pseudo-elevation value into values of three bands of red, green and blue according to a preset corresponding relationship; 根据所述红绿蓝三个波段的数值将所述栅格地形数据保存为图片格式的数据。The raster terrain data is saved as data in a picture format according to the values of the three bands of red, green and blue. 2.根据权利要求1所述的方法,其特征在于,所述将所述高程值转换为伪高程值,包括:2. The method according to claim 1, wherein the converting the elevation value into a pseudo-elevation value comprises: 将单位是米的所述高程值与一预设值相加后乘以1000,并将相乘得到的数值按照设定的第一取整规则进行取整,得到单位是毫米且为正整数的伪高程值。Add the elevation value in meters and a preset value and multiply by 1000, and round the multiplied value according to the first rounding rule set to obtain a positive integer in millimeters. Pseudo-elevation value. 3.根据权利要求1所述的方法,其特征在于,所述预设的对应关系包括第一对应关系、第二对应关系和第三对应关系;3. The method according to claim 1, wherein the preset correspondence includes a first correspondence, a second correspondence and a third correspondence; 所述将所述伪高程值按照预设的对应关系转换为红绿蓝三个波段的数值,包括:The conversion of the pseudo-elevation value into the values of three bands of red, green and blue according to a preset corresponding relationship includes: 将所述伪高程值代入所述第一对应关系进行计算,并将计算得到的第一结果按照设定的第二取整规则进行取整,得到红色波段的数值;Substitute the pseudo-elevation value into the first corresponding relationship for calculation, and round up the first result obtained by the calculation according to the set second rounding rule to obtain the value of the red band; 将所述伪高程值和所述红色波段的数值代入所述第二对应关系进行计算,并将计算得到的第二结果按照所述第二取整规则进行取整,得到绿色波段的数值;Substitute the pseudo-elevation value and the value of the red band into the second corresponding relationship for calculation, and round up the second result obtained by the calculation according to the second rounding rule to obtain the value of the green band; 将所述伪高程值、所述红色波段的数值和所述绿色波段的数值代入所述第三对应关系进行计算,得到蓝色波段的数值。The pseudo-elevation value, the value of the red band, and the value of the green band are substituted into the third corresponding relationship for calculation to obtain the value of the blue band. 4.根据权利要求3所述的方法,其特征在于,所述第一对应关系的表达式为:R1=h/256/256,其中,h表示所述伪高程值,R1表示所述第一结果;4. The method according to claim 3, wherein the expression of the first correspondence is: R1=h/256/256, wherein h represents the pseudo-elevation value, and R1 represents the first result; 所述第二对应关系的表达式为:G1=(h-(R*256*256))/256,其中,G1表示所述第二结果,R表示所述红色波段的数值,且R由R1按照设定的第二取整规则进行取整得到;The expression of the second correspondence is: G1=(h-(R*256*256))/256, wherein G1 represents the second result, R represents the value of the red band, and R is determined by R1 It is obtained by rounding according to the set second rounding rule; 所述第三对应关系的表达式为:B=h-(R*256*256)-(G*256),其中,B表示所述蓝色波段的数值,G表示所述绿色波段的数值,且G由G1按照设定的第二取整规则进行取整得到。The expression of the third corresponding relationship is: B=h-(R*256*256)-(G*256), wherein B represents the value of the blue band, G represents the value of the green band, And G is obtained by G1 rounding according to the second rounding rule set. 5.根据权利要求1-4任一项所述的方法,其特征在于,所述方法还包括:5. The method according to any one of claims 1-4, wherein the method further comprises: 根据预设的转换关系,将所述图片格式的数据中的红绿蓝三个波段的数值转换为高程值,从而将所述图片格式的数据逆转换为所述栅格地形数据。According to a preset conversion relationship, the values of the three bands of red, green and blue in the data in the picture format are converted into elevation values, so that the data in the picture format is inversely converted into the raster terrain data. 6.一种地形数据转换装置,其特征在于,所述装置包括:6. A terrain data conversion device, wherein the device comprises: 数据读取模块,用于读取栅格地形数据中的高程值;The data reading module is used to read the elevation value in the raster terrain data; 第一转换模块,用于将所述高程值转换为伪高程值;所述伪高程值为单位是毫米的正整数;a first conversion module, configured to convert the elevation value into a pseudo-elevation value; the pseudo-elevation value is a positive integer with a unit of millimeter; 第二转换模块,用于将所述伪高程值按照预设的对应关系转换为红绿蓝三个波段的数值;a second conversion module, configured to convert the pseudo-elevation value into the values of three bands of red, green and blue according to a preset corresponding relationship; 数据保存模块,用于根据所述红绿蓝三个波段的数值将所述栅格地形数据保存为图片格式的数据。A data saving module, configured to save the raster terrain data as data in a picture format according to the values of the three bands of red, green and blue. 7.根据权利要求6所述的装置,其特征在于,所述第一转换模块,用于将单位是米的所述高程值与一预设值相加后乘以1000,并将相乘得到的数值按照设定的第一取整规则进行取整,得到单位是毫米且为正整数的伪高程值。7 . The device according to claim 6 , wherein the first conversion module is configured to add the elevation value in meters with a preset value and multiply by 1000, and multiply to obtain The value of is rounded according to the first rounding rule set to obtain a pseudo-elevation value with a unit of millimeter and a positive integer. 8.根据权利要求6所述的装置,其特征在于,所述预设的对应关系包括第一对应关系、第二对应关系和第三对应关系;8. The device according to claim 6, wherein the preset corresponding relationship comprises a first corresponding relationship, a second corresponding relationship and a third corresponding relationship; 所述第二转换模块,用于将所述伪高程值代入所述第一对应关系进行计算,并将计算得到的第一结果按照设定的第二取整规则进行取整,得到红色波段的数值;将所述伪高程值和所述红色波段的数值代入所述第二对应关系进行计算,并将计算得到的第二结果按照所述第二取整规则进行取整,得到绿色波段的数值;将所述伪高程值、所述红色波段的数值和所述绿色波段的数值代入所述第三对应关系进行计算,得到蓝色波段的数值。The second conversion module is used for substituting the pseudo-elevation value into the first corresponding relationship for calculation, and rounding the calculated first result according to the set second rounding rule to obtain the red band. Numerical value; substitute the pseudo-elevation value and the numerical value of the red band into the second corresponding relationship for calculation, and round the calculated second result according to the second rounding rule to obtain the numerical value of the green band ; Substitute the pseudo-elevation value, the numerical value of the red wave band and the numerical value of the green wave band into the third corresponding relationship for calculation to obtain the numerical value of the blue wave band. 9.一种电子设备,其特征在于,包括处理器、存储器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现如权利要求1-5中任一项所述的地形数据转换方法的步骤。9. An electronic device, characterized in that it comprises a processor, a memory, and a computer program stored on the memory and running on the processor, the computer program being executed by the processor to achieve the right The steps of the terrain data conversion method described in any one of requirements 1-5. 10.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现如权利要求1-5中任一项所述的地形数据转换方法的步骤。10. A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the terrain according to any one of claims 1-5 is realized The steps of the data transformation method.
CN202111505311.XA 2021-12-10 2021-12-10 Terrain data conversion method, device, electronic device and storage medium Active CN114238471B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111505311.XA CN114238471B (en) 2021-12-10 2021-12-10 Terrain data conversion method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111505311.XA CN114238471B (en) 2021-12-10 2021-12-10 Terrain data conversion method, device, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN114238471A true CN114238471A (en) 2022-03-25
CN114238471B CN114238471B (en) 2025-02-28

Family

ID=80754638

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111505311.XA Active CN114238471B (en) 2021-12-10 2021-12-10 Terrain data conversion method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN114238471B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108225342A (en) * 2016-12-22 2018-06-29 沈阳美行科技有限公司 A kind of map datum system, generation and application method and its application
CN108282643A (en) * 2018-02-12 2018-07-13 武汉斗鱼网络科技有限公司 Image processing method, image processing apparatus and electronic equipment
CN108898681A (en) * 2018-06-26 2018-11-27 中煤航测遥感集团有限公司 Digital elevation model processing method and processing device
CN111506680A (en) * 2019-01-31 2020-08-07 阿里巴巴集团控股有限公司 Terrain data generation method, terrain data rendering method, terrain data generation device, terrain data rendering device, medium, server and terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108225342A (en) * 2016-12-22 2018-06-29 沈阳美行科技有限公司 A kind of map datum system, generation and application method and its application
CN108282643A (en) * 2018-02-12 2018-07-13 武汉斗鱼网络科技有限公司 Image processing method, image processing apparatus and electronic equipment
CN108898681A (en) * 2018-06-26 2018-11-27 中煤航测遥感集团有限公司 Digital elevation model processing method and processing device
CN111506680A (en) * 2019-01-31 2020-08-07 阿里巴巴集团控股有限公司 Terrain data generation method, terrain data rendering method, terrain data generation device, terrain data rendering device, medium, server and terminal

Also Published As

Publication number Publication date
CN114238471B (en) 2025-02-28

Similar Documents

Publication Publication Date Title
JP6932163B2 (en) 3D data processing method, equipment, equipment and storage medium
US10565254B2 (en) System and method for storing points of polygons related to an image
CN108563711B (en) A time-series data storage method based on time nodes
CN102411616B (en) Method and system for storing data and data management method
CN102750294B (en) A method, device and system for generating terrain image data
US20140278228A1 (en) Mapping uncertain geometries to graticules
US20140164438A1 (en) System and method for providing structured data to a structured or unstructured grid
KR20210090249A (en) Image processing method, apparatus, vehicle-mounted computing platform, electronic device and system
JP2017005456A (en) Image compression method, image compression device and imaging apparatus
CN114238471A (en) Terrain data conversion method and device, electronic equipment and storage medium
US9354825B2 (en) Software development kit for LiDAR data
CN113836095A (en) Point cloud data storage method and device, storage medium and electronic equipment
CN117009291B (en) 3D model asset file simplified conversion method and system based on mobile terminal
CN118097008A (en) Method for converting mesh format files into numerical analysis software files
JPS6346608B2 (en)
JP3337697B2 (en) Image processing method
Jóźków Terrestrial laser scanning data compression using JPEG-2000
JP2018113583A (en) Information processing apparatus, information processing method, and program
CN117171376A (en) A block terrain feature index storage and reading method for dem raster data
CN112053425B (en) Multispectral image processing method and device and electronic equipment
KR20080079344A (en) Geographic data compression and restoration system and method
RU2671304C1 (en) Method and system for constructing digital print of video content
CN119628652A (en) Data processing method, device, electronic device, storage medium and program product
CN113742303A (en) Compression method of power load data and terminal
CN117496082B (en) Automatic three-dimensional white film data release method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant