A database-based raster data segmentation method and apparatus
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-08-14
AI Technical Summary
[0003]北斗网格码是在地球空间网格编码基础上发展出的一种适用于导航定位服务的全球地理网格编码模型,大多为文本格式,与全球剖分网格不同,北斗网格码的各级网格的剖分标准不一样不同,无法由一个无符号长整形数据表示,因此想通过文本格式的北斗网格码计算出其他北斗网格码过程十分繁琐,涉及文本解析和各级网格的进制转换等步骤
按照北斗网格码设计预设编码,将栅格数据中的参考位置的坐标进行预设编码,通过预设编码参考位置编码坐标进行切分网格设定,并进行切分合法性判断,以保证切分过程合法,根据设定好的切分网格将栅格数据按照北斗网格码位置进行切分,实现栅格数据中同北斗网格码位置相对应的各个子栅格的数据提取;通过所述预设编码来简化栅格数据在进行坐标编码转换以及数据提取时的计算复杂度。
Smart Images

Figure CN122570618A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of database technology, and more specifically, relates to a database-based raster data segmentation method and apparatus. Background Technology
[0002] Earth grid coding is a technology that divides the Earth's surface and three-dimensional space into multi-scale, multi-resolution grid units and uniquely identifies them using unified rules. It has both binary and text formats. Earth grid coding is divided into 32 levels, each level bisecting the coordinate system along latitude and longitude. Therefore, its binary format can be represented by an unsigned long integer, with each level corresponding to two bits, and the code value corresponding one-to-one with the grid. Other Earth grid codes can be calculated from one Earth grid code.
[0003] BeiDou grid code is a global geographic grid coding model developed based on geospatial grid coding, suitable for navigation and positioning services. It is mostly in text format. Unlike the global subdivision grid, the subdivision standards of each level of the BeiDou grid code are different, and it cannot be represented by an unsigned long integer. Therefore, the process of calculating other BeiDou grid codes from the text-format BeiDou grid code is very complicated, involving text parsing and number system conversion of each level of grid.
[0004] In the application scenario of BeiDou grid codes for raster data extraction, the raster data needs to be divided into grids according to the form of BeiDou grid coding in order to visualize it at different coding levels. Therefore, the existing technology requires the raster data to be divided into grids according to the form corresponding to the BeiDou grid codes. However, the problem is that the BeiDou grid codes of different sub-grids obtained by the division need to be calculated based on other BeiDou grid codes. The calculation between different BeiDou grid codes is relatively complicated. Furthermore, when calculating the BeiDou grid code through coordinate values, it is necessary to calculate the relative grid position of the coordinate values in each level of the grid for each coding level and finally combine them together, which is relatively complicated.
[0005] Therefore, overcoming the shortcomings of the existing technology is an urgent problem to be solved in this technical field. Summary of the Invention
[0006] The problem this invention aims to solve is how to reduce computational complexity and accelerate processing efficiency when segmenting and extracting raster data based on BeiDou grid codes.
[0007] Firstly, a database-based raster data partitioning method is provided, including: Parse raster data, obtain raster information, and set preset encoding levels; Based on the raster information and the preset encoding level, preset encoding is performed to obtain the encoded coordinates of the raster data reference position, which are then used as reference encoded coordinates; The segmentation grid is set according to the raster information and the reference coded coordinates; Based on the reference encoded coordinates of the raster data and the segmented grid, the preset encoded data of each sub-raster after segmentation is obtained respectively; Data is extracted from each sub-raster based on the preset encoding data of each sub-raster.
[0008] Preferably, the raster information includes: coordinate information of the reference position of the raster data, pixel distribution in the raster data, and pixel size of a single pixel.
[0009] Preferably, the step of setting the segmentation grid based on the raster information and the reference coded coordinates specifically includes: Set the horizontal and vertical lengths of the grid, and set the horizontal and vertical lengths of each individual cell within the grid. The coded coordinates of the reference position of the segmented grid are obtained based on the reference coded coordinates of the raster data, the horizontal length of the segmented grid, the vertical length of the segmented grid, and the horizontal and vertical lengths of a single segmented cell in the segmented grid. The boundary position of the segmented grid is obtained based on the coded coordinates of the reference position of the segmented grid, the horizontal length of the segmented grid, and the vertical length of the segmented grid.
[0010] Preferably, the method further includes: performing a segmentation validity check on the segmented mesh; the segmentation validity check requires that the following conditions be met simultaneously: The length of a single pixel in raster data is divisible by the length of the grid cells, and the width of a single pixel in raster data is divisible by the width of the grid cells. The length of a single pixel in raster data is divisible by the horizontal distance between the starting point of the raster data and the boundary of the nearest dividing grid, and the width of a single pixel in raster data is divisible by the vertical distance between the starting point of the raster data and the boundary of the nearest dividing grid.
[0011] Preferably, the step of obtaining the preset encoded data for each sub-grid after segmentation based on the reference encoded coordinates of the raster data and the segmentation grid specifically includes: The raster data is divided into multiple sub-raster arrays by the aforementioned grid. Based on the position of each sub-grid in the raster data, the horizontal and vertical index positions of each sub-grid are obtained. Based on the reference coding coordinates of the raster data, the horizontal position of each sub-raster, and the vertical position of each sub-raster, the preset coding data of each sub-raster is obtained.
[0012] Preferably, the step of obtaining the encoded coordinates of the raster data reference position based on the raster information and the preset encoding level, and using them as reference encoded coordinates, specifically includes: When the coordinates (x, y) of the raster data reference position are within the first preset latitude interval, the coded coordinates corresponding to the coordinates (x, y) are (i, lon, lat), where: ; ; Where i represents the encoding level, lon represents the horizontal raster number of the grid where the coordinate is located, and lat represents the vertical raster number of the grid where the coordinate is located. The horizontal grid size at encoding level i. The vertical grid size at encoding level i; When the coordinates (x, y) of the raster data reference position are within the second preset latitude range, the raster data reference coded coordinates are obtained by calculating step by step from the coded level 0 to the preset coded level.
[0013] Preferably, when the coordinates (x, y) of the raster data reference position are within the second preset latitude interval, the raster data reference coded coordinates are calculated step by step from coding level 0 to the preset coding level, specifically including: When the coordinates (x, y) of the raster data reference position are within the second preset latitude range, the coordinates of the raster data reference position are preprocessed to obtain the preprocessed coordinates (x, y). When the coding level i is 0, the coding coordinates corresponding to coordinates (x, y) are: ,in, , ; When the coding level i is 1 and y < 1, the coding coordinates corresponding to coordinates (x, y) are: The coordinates (x, y) are transformed into ,in: , , , , To round down; When the coding level i is 1 and y≥1, the coding coordinates corresponding to the coordinates (x,y) are: coordinates are converted ,in: , , , ; When the coding level i is greater than 1 and and When the coordinates (x, y) correspond to the encoded coordinates, the encoded coordinates are: The coordinates (x, y) are transformed into ,in: , , , ; When the coding level i is greater than 1 and When the coordinates (x, y) correspond to the encoded coordinates, the encoded coordinates are: The coordinates (x, y) are transformed into ,in: , , , .
[0014] Preferably, the database-based raster data segmentation method further includes: Convert the preset encoded data of each sub-grid into BeiDou grid code; The extracted data corresponding to each sub-grid is retrieved via the BeiDou grid code and visualized on the front end.
[0015] In a second aspect, a database-based raster data segmentation apparatus is provided, comprising at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the processor to perform the database-based raster data segmentation method.
[0016] Thirdly, the present invention also provides a non-volatile computer storage medium storing computer-executable instructions that are executed by one or more processors to perform the method described in the first aspect.
[0017] Fourthly, a chip is provided, comprising: a processor and an interface for calling and running a computer program stored in memory, performing the method as described in the first aspect.
[0018] Fifthly, a computer program product containing instructions is provided that, when executed on a computer or processor, causes the computer or processor to perform the method as described in the first aspect.
[0019] In a sixth aspect, a database-based raster data segmentation apparatus is provided, including the database-based raster data segmentation apparatus of the second aspect, and using the database-based raster data segmentation method of the first aspect.
[0020] Unlike existing technologies, the present invention has at least the following beneficial effects: According to the BeiDou grid code design preset encoding, the coordinates of the reference position in the raster data are preset encoded. The grid is set by using the preset encoded reference position coordinates, and the validity of the segmentation is judged to ensure that the segmentation process is legal. According to the set segmentation grid, the raster data is segmented according to the BeiDou grid code position, realizing the data extraction of each sub-raster corresponding to the BeiDou grid code position in the raster data. The preset encoding simplifies the computational complexity of raster data when performing coordinate encoding conversion and data extraction. Attached Figure Description
[0021] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments of the present invention will be briefly described below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0022] Figure 1 This is a flowchart of a database-based raster data segmentation method provided in this embodiment; Figure 2 This is a flowchart of the method for setting the grid segmentation in a database-based raster data segmentation method provided in this embodiment; Figure 3 This is a flowchart illustrating the method for obtaining preset encoded data for each sub-grid after segmentation in a database-based raster data segmentation method provided in this embodiment. Figure 4 This is a schematic diagram illustrating the acquisition of preset encoded data for each sub-raster in a database-based raster data segmentation method provided in this embodiment; Figure 5 This is an overall flowchart of a database-based raster data segmentation method provided in this embodiment; Figure 6 This embodiment provides a flowchart of a data extraction and visualization method for a database-based raster data segmentation method. Figure 7 This is a schematic diagram of a database-based raster data segmentation device provided in this embodiment. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0024] Unless the context otherwise requires, throughout the specification and claims, the term "comprising" is interpreted as openly inclusive, meaning "including, but not limited to." In the description of the specification, terms such as "one embodiment," "some embodiments," "exemplary embodiment," "example," "specific example," or "some examples" are intended to indicate that a particular feature, structure, material, or characteristic associated with that embodiment or example is included in at least one embodiment or example of this disclosure. The illustrative representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics mentioned may be included in any suitable manner in any one or more embodiments or examples; that is, although they may be incorporated into embodiments or examples using the above terms for reasons such as order and position, it does not limit them to be incorporated in combination by a single embodiment or example.
[0025] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of embodiments of this disclosure, unless otherwise stated, "a plurality of" means two or more. Furthermore, for example, the description may use the prefix "A" or "B" to describe the same type of nouns as two independent entities. In this case, the corresponding features defined with "A" and "B" are used only to distinguish between similar entities and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features.
[0026] In the description of this invention, the expression “A and / or B” (where A and B are used to formally represent specific features) will be used. The corresponding expression includes the following three combinations: only A, only B, and a combination of A and B.
[0027] As used in this invention, “about,” “approximately,” or “approximately” includes the stated value and the average value within an acceptable range of deviation from a particular value, wherein the acceptable range of deviation is determined by a person skilled in the art taking into account the measurement under discussion and the error associated with the measurement of the particular quantity (i.e., the limitations of the measurement system).
[0028] Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0029] Example 1: This embodiment provides a database-based raster data segmentation method, such as... Figure 1 As shown, the method flow includes the following.
[0030] In step 101, the raster data is parsed to obtain the raster information and a preset encoding level is set.
[0031] The application scenario of the method provided in this embodiment is as follows: based on the Beidou grid code, the grid data is divided into preset grid segments, the data of each sub-grid after segmentation is extracted, and the data is called on the front end through the Beidou grid code for user interactive query.
[0032] In this embodiment, the raster information includes: coordinate information of the reference position of the raster data, pixel distribution in the raster data, and pixel size of a single pixel. In this embodiment, the reference position can refer to the upper left corner of the raster data. Before raster segmentation, the raster data needs to be parsed to facilitate subsequent data extraction by determining the information corresponding to each sub-raster based on the raster information. The pixel distribution in the raster data refers to the number of pixels in the horizontal direction and the number of pixels in the vertical direction. The size of a single pixel remains unchanged, and the size expression of the raster data is as follows: L x =S x ×Num x ; L y =S y ×Num y ; Among them, L x S represents the horizontal length of the raster data. x Num represents the horizontal length of a single pixel. x L represents the number of pixels in the raster data in the horizontal direction. y S represents the vertical length of the raster data. y Num represents the vertical length of a single pixel. y This represents the number of pixels in the vertical direction of the raster data.
[0033] Furthermore, since the raster data needs to be divided into grids according to the BeiDou grid code form for visualization at different coding levels during subsequent data extraction, the existing technology requires the raster data to be divided into grids according to the form corresponding to the BeiDou grid code. However, the problem is that the BeiDou grid code of the different sub-rasters obtained by the division needs to be calculated based on other BeiDou grid codes, and the calculation between different BeiDou grid codes is relatively complex. At the same time, the calculation of the conversion between BeiDou grid code and latitude and longitude coordinates is also relatively complex. In order to reduce the computational complexity of raster data processing, this embodiment also involves the following steps.
[0034] In step 102, the grid information and the preset encoding level are used to perform preset encoding to obtain the encoded coordinates of the grid data reference position, which are then used as reference encoding coordinates.
[0035] In step 103, the segmentation grid is set according to the grid information and the reference coded coordinates.
[0036] In this embodiment, before segmenting the raster data, the coordinates of the reference position of the raster data are pre-encoded to obtain coded coordinates. In this embodiment, the pre-encoded coordinates are BDCode. The reference coded coordinates are the coded coordinates of the upper left corner of the raster data. The subsequent segmentation grid is set based on these coded coordinates. The pre-encoded coordinates are an intermediate encoding format between the original coordinates and the BeiDou grid code. The pre-encoded coordinates represent the positions of different BeiDou grid codes, and can be quickly converted between the pre-encoded coordinates and the original coordinates, simplifying the calculation. Therefore, converting different coordinate positions on the raster data to the pre-encoded coordinates is equivalent to obtaining the BeiDou grid code corresponding to that coordinate position. In this embodiment, the raster data reference position can be the reference position of the raster data. Setting the segmentation grid based on the reference coded coordinates ensures that each sub-raster obtained from the segmentation grid corresponds to the BeiDou grid code, which is simpler to calculate than directly cutting the raster data according to the BeiDou grid code position.
[0037] In this embodiment, after setting the segmentation grid, it is also necessary to judge the legality of the segmentation grid. The judgment of the legality of the segmentation grid means that when segmenting the raster data through the segmentation grid, it is necessary to ensure that the edge position of each sub-grid in the segmentation grid matches the edge position of the pixel in the raster data, so as to avoid segmenting the pixels in the raster data and ensure the legality of the segmentation.
[0038] In step 104, the preset encoded data of each sub-grid after segmentation is obtained according to the encoded coordinates of the grid data reference position and the segmentation grid.
[0039] In step 105, data is extracted from each sub-grid according to the preset encoding data of each sub-grid.
[0040] Since only the coded coordinates of the raster data reference positions were previously obtained, in order to extract data from all the sub-rasteres after segmentation, it is necessary to obtain the preset coded data for each sub-raster based on the coded coordinates of the raster data reference positions. Data extraction is then performed based on the preset coded data, and the extracted data is visualized on the front end in the form of BeiDou grid codes. During extraction, each sub-raster needs to be extracted according to the raster information, in a left-to-right and top-to-bottom order.
[0041] In this embodiment, the coordinates of the reference position in the raster data are preset and encoded according to the BeiDou grid code design. The grid is then set based on the preset encoded reference position coordinates, and the validity of the segmentation is checked to ensure that the segmentation process is legal. The raster data is then segmented according to the BeiDou grid code position based on the set segmentation grid, so as to extract the data of each sub-raster corresponding to the BeiDou grid code position in the raster data. The preset encoding simplifies the computational complexity of raster data when performing coordinate encoding conversion and data extraction.
[0042] Furthermore, in this embodiment, the preset encoding is designed based on the BeiDou grid code and is used to encode and convert the actual coordinate position on the grid data. The original actual encoding is represented by the encoded coordinates. A segmentation grid is set based on the encoded coordinates so that the grid data is segmented according to the BeiDou grid code position. Therefore, the encoding rules for the preset encoding in this embodiment involve the following design.
[0043] The step of obtaining the encoded coordinates of the raster data reference position by performing preset encoding based on the raster information of the raster data and the preset encoding level specifically includes: When the coordinates (x, y) of the raster data reference position are within the first preset latitude interval, the coded coordinates corresponding to the coordinates (x, y) are (i, lon, lat), where: ; ; Where i represents the encoding level, lon represents the horizontal raster number of the grid where the coordinate is located, and lat represents the vertical raster number of the grid where the coordinate is located. The horizontal grid size at encoding level i. This represents the vertical grid size at encoding level i.
[0044] In this embodiment, the first preset latitude range can be According to the BeiDou grid code encoding rules, the grid size of each level in the latitude and longitude directions is shown in Table 1 below: Table 1
[0045] When the coordinates (x, y) of the raster data reference position are within the second preset latitude range, the encoded coordinates of the raster data reference position are calculated step by step from encoding level 0 to the preset encoding level.
[0046] To explain the meaning of step-by-step calculation in a relatively intuitive way, let's take the following example: When the set coding level is 2, it is necessary to start from coding level 0, calculate the coding coordinates and coordinate update values corresponding to the coordinates at coding level 0, and then substitute the coding coordinates and coordinate update values at coding level 0 into the calculation at coding level 1 to obtain the coding coordinates and coordinate update values corresponding to the coordinates at coding level 1. Then, substitute the coding coordinates and coordinate update values at coding level 1 into the calculation at coding level 2 to obtain the coding coordinates and coordinate update values corresponding to the coordinates at coding level 2.
[0047] The second preset latitude range can be: When the coordinates are located in the second preset latitude interval, it means that the coordinates are located in the North and South Poles. In this case, the preset code corresponding to the coordinates needs to be calculated step by step. When the coordinates (x, y) of the raster data reference position are within the second preset latitude range, the coordinates of the raster data reference position are preprocessed to obtain the preprocessed coordinates (x, y).
[0048] The coordinates are converted to: y=90-y, x=x-180.
[0049] When the coding level i is 0, the coding coordinates corresponding to coordinates (x, y) are: ,in, , When the encoding level is 0, this is the maximum magnification level, with only one grid. Therefore, the corresponding encoding coordinates are... .
[0050] When the coding level i is 1 and y < 1, the coordinates (x, y) are located closer to the North Pole at the current coding level, and the corresponding coded coordinates (x, y) are: The coordinates (x, y) are transformed into ,in: , , , .
[0051] When the coding level i is 1 and y ≥ 1, the coordinates (x, y) are located furthest from the North Pole at the current coding level, and the corresponding coded coordinates (x, y) are: coordinates are converted ,in: , , , .
[0052] When the coding level i is greater than 1 and and When, it means that at both coding level i-1 and coding level i, this coordinate is close to the North Pole, and the coded coordinates corresponding to coordinates (x, y) are: ,in: , , , .
[0053] When the coding level i is greater than 1 and and When, it means that at coding level i-1, the coordinates are all close to the North Pole, and the coded coordinates corresponding to coordinates (x, y) are: The coordinates (x, y) are transformed into ,in: , , , .
[0054] When the coding level i is greater than 1 and When, it means that at coding level i-1, the coordinates are all far from the North Pole, and the coded coordinates corresponding to coordinates (x, y) are: The coordinates (x, y) are transformed into ,in: , , , .
[0055] In summary, the above is the encoding method for the preset encoding provided in this embodiment, which is used to convert actual coordinates into preset encoding, and to represent the encoding level corresponding to the actual coordinates and the Beidou grid code position corresponding to the encoding level. In the method provided in this embodiment, the grid data is first parsed to obtain the grid size, coordinate position of the reference position and pixel size in the grid data. The coordinates of the reference position of the grid data are preset encoded to obtain the encoded coordinates of the reference position of the grid data.
[0056] After obtaining the encoded coordinates of the raster data reference position, it is necessary to set the segmentation grid based on the encoded coordinates and pixel size of the raster data reference position to ensure the validity of the segmentation grid. The corresponding design is as follows.
[0057] The segmentation grid is set according to the raster information of the raster data and the encoded coordinates of the raster data reference position, such as... Figure 2 As shown, the steps include the following.
[0058] In step 201, the horizontal and vertical lengths of the segmented grid are set, and the horizontal and vertical lengths of individual segments in the segmented grid are also set.
[0059] In this embodiment, a segmented grid is a single segmentation unit arranged in an array within a segmented grid. After the segmented grid divides the raster data, each segmented grid corresponds to a single sub-raster data content.
[0060] In step 202, the coded coordinates of the reference position of the segmented grid are obtained based on the reference coded coordinates of the raster data, the horizontal length of the segmented grid, the vertical length of the segmented grid, and the horizontal and vertical lengths of a single segmented cell in the segmented grid.
[0061] In step 203, the boundary position of the segmented grid is obtained based on the coded coordinates of the reference position of the segmented grid, the horizontal length of the segmented grid, and the vertical length of the segmented grid.
[0062] The above steps are the steps for setting the segmentation grid, which ensures that the segmentation grid can cover the entire raster data. Furthermore, when segmenting the raster data, it is necessary to ensure that the segmentation grid does not segment individual pixels, leading to invalid raster data segmentation. Therefore, this embodiment also involves the following design: The segmentation grid segmentation validity judgment specifically includes the following.
[0063] The segmentation validity check requires the following conditions to be met simultaneously: The length of a single pixel in raster data is divisible by the length of the grid cells, and the width of a single pixel in raster data is divisible by the width of the grid cells.
[0064] The length of a single pixel in raster data is divisible by the horizontal distance between the starting point of the raster data and the boundary of the nearest dividing grid, and the width of a single pixel in raster data is divisible by the vertical distance between the starting point of the raster data and the boundary of the nearest dividing grid.
[0065] While satisfying the above conditions, it can be guaranteed that the size of a single pixel in the raster data can be divided by a single segmentation cell in the segmentation grid, and the position of each segmentation line in the segmentation grid exactly matches the edge position of the pixel in the raster data. This ensures that all segmentation lines in the segmentation grid are segmented along the pixel edge, avoiding the situation where pixels in the raster data are segmented and preventing illegal segmentation.
[0066] Furthermore, since the coded coordinates of the raster data reference position have been obtained, and the segmentation grid used to divide the raster data has also been obtained, the coded coordinates of the raster data reference position are used to represent the sub-raster at the reference position after segmentation. Therefore, after segmentation, other sub-rasters can obtain the preset coded data corresponding to each sub-raster based on their relative position with the reference position sub-raster.
[0067] The preset encoded data for each sub-grid after segmentation is obtained based on the encoded coordinates of the raster data reference position and the segmentation grid, such as... Figure 3 As shown, the method flow includes: as follows.
[0068] In step 301, the raster data is divided into multiple sub-raster arrays by the segmentation grid.
[0069] In step 302, based on the position of each sub-grid in the grid data, the horizontal and vertical serial numbers of each sub-grid are obtained.
[0070] The horizontal sequence number position refers to the position of the sub-raster in the horizontal direction of the segmented raster data, and the vertical sequence number position refers to the position of the sub-raster in the vertical direction of the segmented raster data.
[0071] In step 303, the preset encoded data of each sub-grid is obtained based on the encoded coordinates of the raster data reference position, the horizontal sequence position of each sub-grid, and the vertical sequence position of each sub-grid.
[0072] In this embodiment, for the preset encoded data of each sub-raster in the raster data, starting from the sub-raster at the reference position of the raster data, according to... Figure 4 The data is updated sequentially from left to right and from top to bottom (i.e., from west to east and from north to south) to generate the preset coded data for the corresponding sub-grids. Figure 4 The shaded area represents raster data, and the grid is a subdivided grid. Figure 4 The horizontal arrows in the middle indicate the horizontal sequence numbers of the sub-grids from bdcode.lon to bdcode.lon+M-1. Figure 4 The vertical arrows in the middle, from bdcode.lat to bdcode.lat+M-1, represent the vertical sequence numbers of the sub-grids. For example... Figure 5 The diagram shows the overall method flow provided in this embodiment.
[0073] To more clearly illustrate the above method, this embodiment uses the following example: the encoded coordinates of the raster data reference position are... After the raster data is segmented, one sub-raster has a horizontal index of 4 and a vertical index of 3. Therefore, the preset encoded data corresponding to this sub-raster is: .
[0074] Furthermore, after obtaining the preset encoding data of all sub-grids, the data at a specified position in the grid data is extracted according to the preset encoding data to obtain the data corresponding to the sub-grid. When visualizing this data on the front end, the preset encoding data also needs to be converted into BeiDou grid data. Therefore, this embodiment also involves the following design.
[0075] The database-based raster data segmentation method, such as Figure 6 As shown, the method flow also includes...
[0076] In step 401, the preset encoded data of each sub-grid is converted into BeiDou grid data.
[0077] In this embodiment, the preset encoded data is converted into BeiDou grid data as follows: the preset encoded data is {level,lon,lat}, and then converted using bd_num. x arrays and bd_num y The array represents the relative position of the Beidou grid code in the grid at each coding level. The hemispherical position of the preset coding data is determined based on lon and lat. The hemispherical position can be in the Eastern Hemisphere, Western Hemisphere, Southern Hemisphere, or Northern Hemisphere.
[0078] Based on the hemispherical location of the preset encoded data, at the encoding level, lon is converted into the lon0th grid in the direction outward from the Prime Meridian, and lat is converted into the lat0th grid in the direction from the equator to the North and South Poles, with the numbering starting from 0.
[0079] The calculation proceeds step by step from coding level 1 to coding level+1, with the pre-defined position of the coded data in each sub-grid at each level, namely the arrays bd_numx and bd_numy.
[0080] Based on the North and South Pole locations and the arrays bd_numx and bd_numy, the text encoding of the BeiDou grid is calculated level by level from level 1 to level+1, generating the text format of the BeiDou grid encoding.
[0081] In step 402, the extracted data corresponding to each sub-grid is visualized on the front end in the form of the BeiDou grid data.
[0082] Furthermore, for the method of converting preset encoded data back to the original coordinates, refer to the aforementioned method flow for converting original coordinates to preset encoded data, and simply reverse the method flow.
[0083] Example 2: like Figure 7The diagram shown is a schematic representation of a database-based raster data segmentation device according to an embodiment of the present invention. This database-based raster data segmentation device includes one or more processors 41 and a memory 42.
[0084] Processor 41 and memory 42 can be connected via a bus or other means. Figure 7 Taking the example of a connection between China and Israel via a bus.
[0085] The memory 42, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs and non-volatile computer-executable programs, such as the database-based raster data segmentation method in the above embodiments. The processor 41 executes the database-based raster data segmentation method by running the non-volatile software program and instructions stored in the memory 42.
[0086] Memory 42 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 42 may optionally include memory remotely located relative to processor 41, which can be connected to processor 41 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0087] The program instructions / modules are stored in the memory 42 and, when executed by one or more processors 41, perform the database-based raster data segmentation method described in the above embodiments.
[0088] This invention also provides a computer storage medium storing computer program instructions; when executed by a processor, the computer program instructions implement the database-based raster data segmentation method provided in this invention.
[0089] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A database-based raster data segmentation method, characterized in that, include: Parse raster data, obtain raster information, and set preset encoding levels; Based on the raster information and the preset encoding level, preset encoding is performed to obtain the encoded coordinates of the raster data reference position, which are then used as reference encoded coordinates; The segmentation grid is set according to the raster information and the reference coded coordinates; Based on the reference encoded coordinates of the raster data and the segmented grid, the preset encoded data of each sub-raster after segmentation is obtained respectively; Data is extracted from each sub-raster based on the preset encoding data of each sub-raster.
2. The database-based raster data segmentation method according to claim 1, characterized in that, The raster information includes: the coordinates of the reference position of the raster data, the pixel distribution in the raster data, and the pixel size of a single pixel.
3. The database-based raster data segmentation method according to claim 1, characterized in that, The step of setting the segmentation grid based on the raster information and the reference coded coordinates specifically includes: Set the horizontal and vertical lengths of the grid, and set the horizontal and vertical lengths of each individual cell within the grid. The coded coordinates of the reference position of the segmented grid are obtained based on the reference coded coordinates of the raster data, the horizontal length of the segmented grid, the vertical length of the segmented grid, and the horizontal and vertical lengths of a single segmented cell in the segmented grid. The boundary position of the segmented grid is obtained based on the coded coordinates of the reference position of the segmented grid, the horizontal length of the segmented grid, and the vertical length of the segmented grid.
4. The database-based raster data segmentation method according to claim 1, characterized in that, The method further includes: performing a segmentation validity check on the segmented mesh; the segmentation validity check requires that the following conditions be met simultaneously: The length of a single pixel in raster data is divisible by the length of the grid cells, and the width of a single pixel in raster data is divisible by the width of the grid cells. The length of a single pixel in raster data is divisible by the horizontal distance between the starting point of the raster data and the boundary of the nearest dividing grid, and the width of a single pixel in raster data is divisible by the vertical distance between the starting point of the raster data and the boundary of the nearest dividing grid.
5. The database-based raster data segmentation method according to claim 1, characterized in that, The step of obtaining the preset encoded data for each sub-grid after segmentation based on the reference encoded coordinates of the raster data and the segmentation grid specifically includes: The raster data is divided into multiple sub-raster arrays by the aforementioned grid. Based on the position of each sub-grid in the raster data, the horizontal and vertical index positions of each sub-grid are obtained. Based on the reference coding coordinates of the raster data, the horizontal position of each sub-raster, and the vertical position of each sub-raster, the preset coding data of each sub-raster is obtained.
6. The database-based raster data segmentation method according to claim 1, characterized in that, The step of obtaining the encoded coordinates of the raster data reference position by performing preset encoding based on the raster information and the preset encoding level, and using them as reference encoded coordinates, specifically includes: When the coordinates (x, y) of the raster data reference position are within the first preset latitude interval, the coded coordinates corresponding to the coordinates (x, y) are (i, lon, lat), where: ; ; Where i represents the encoding level, lon represents the horizontal raster number of the grid where the coordinate is located, and lat represents the vertical raster number of the grid where the coordinate is located. The horizontal grid size at encoding level i. The vertical grid size at encoding level i; When the coordinates (x, y) of the raster data reference position are within the second preset latitude range, the raster data reference coded coordinates are obtained by calculating step by step from the coded level 0 to the preset coded level.
7. The database-based raster data segmentation method according to claim 5, characterized in that, When the coordinates (x, y) of the raster data reference position are within the second preset latitude interval, the raster data reference coded coordinates are calculated step by step from coding level 0 to the preset coding level. Specifically, this includes: When the coordinates (x, y) of the raster data reference position are within the second preset latitude range, the coordinates of the raster data reference position are preprocessed to obtain the preprocessed coordinates (x, y). When the coding level i is 0, the coding coordinates corresponding to coordinates (x, y) are: ,in, , ; When the coding level i is 1 and y < 1, the coding coordinates corresponding to coordinates (x, y) are: The coordinates (x, y) are transformed into ,in: , , , , To round down; When the coding level i is 1 and y≥1, the coding coordinates corresponding to the coordinates (x,y) are: coordinates are converted ,in: , , , ; When the coding level i is greater than 1 and and When the coordinates (x, y) correspond to the encoded coordinates, the encoded coordinates are: The coordinates (x, y) are transformed into ,in: , , , ; When the coding level i is greater than 1 and When the coordinates (x, y) correspond to the encoded coordinates, the encoded coordinates are: The coordinates (x, y) are transformed into ,in: , , , .
8. The database-based raster data segmentation method according to claim 1, characterized in that, The database-based raster data segmentation method also includes: Convert the preset encoded data of each sub-grid into BeiDou grid code; The data extracted from each sub-grid is retrieved using the BeiDou grid code and visualized on the front end.
9. A database-based raster data segmentation device, characterized in that, The method includes at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor for performing the database-based raster data segmentation method according to any one of claims 1-8.
10. A non-volatile computer storage medium, characterized in that, The computer storage medium stores computer program instructions that, when executed by one or more processors, implement the database-based raster data segmentation method as described in any one of claims 1-8.