A coding computation method based on hierarchical grid optimization
By generating a minimum coding matrix and separating the paired base coding raster and target location file, the problem of repetitive processing of coding distribution patterns in different map sheets is solved, and efficient positioning and adaptation of coding data is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 安徽省第一测绘院
- Filing Date
- 2026-06-11
- Publication Date
- 2026-07-17
Smart Images

Figure CN122415762A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of spatial coding technology, and more specifically to a coding calculation method based on hierarchical grid optimization. Background Technology
[0002] Spatial identity coding, basic geographic entity coding, and BeiDou grid location codes typically require coding and calculation of point, line, and area entities or standard map results according to hierarchical segmentation rules. This type of processing facilitates the unified expression of geographic object locations, supports spatial data retrieval and result quality checks, and can form a unified location identification basis in real-scene 3D, surveying and mapping result management, and gridded spatial indexing.
[0003] Currently, in the process of generating spatial identity coding standard grids across multiple map sheets in batches, coding is usually calculated level by level according to a single grid or a single map sheet. The grid coding distribution patterns that appear repeatedly in different map sheets are difficult to be uniformly called, which leads to the need to generate the coding distribution under the same level of subdivision rule multiple times, thereby increasing the amount of computation for grid-by-grid coding and the time for batch result generation.
[0004] Secondly, although different map sheets have the same or similar grid coding arrangement rules, there are differences in the map sheet boundary position and the starting position of geographic coordinates. If the coding content and geographic positioning content are fixed and stored together, it is easy to cause the same code to be repeatedly saved in different map sheets, and make the coordinate adaptation of the coding data in any map sheet depend on the regeneration process. Summary of the Invention
[0005] To address the aforementioned technical problems, this invention provides a coding calculation method based on hierarchical grid optimization.
[0006] A coding computation method based on hierarchical grid optimization includes: Collect hierarchical grid parameters and target map sheet positioning data. The hierarchical grid parameters include hierarchical segmentation code, number of hierarchical rows, number of hierarchical columns and hierarchical span value, and generate a minimum coding matrix based on hierarchical segmentation code, number of hierarchical rows and number of hierarchical columns. The target map sheet span value is calculated using the target map sheet location data and the hierarchical span value. Based on the target map sheet span value, the hierarchical span value, and the minimum coding matrix, the number of rows and columns of the matrix are generated. A complete coded raster is generated based on the minimum coded matrix, the number of rows in the matrix tiling, and the number of columns in the matrix tiling, and the complete coded raster is written into the base coded raster of unfixed geographic coordinates; The pixel center coordinates are calculated using the target map sheet location data and the layer span value. After the pixel center coordinates are written into the target location file, they are bound to the basic coding raster to generate the target map sheet coding result.
[0007] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention enables the number of rows and columns of the matrix to be determined according to the coverage of the target map sheet by establishing the correspondence between the target map sheet span value, the layer span value, and the minimum coding matrix. This reduces the per-grid coding computation of the standard map sheet grid when generating multiple target map sheets in batches, and transforms the repetitive grid coding distribution pattern into a reusable coding distribution unit, thereby reducing the amount of repetitive coding processing in the process of generating a complete coding raster. Furthermore, this invention separates and pairs the base coded raster with unfixed geographic coordinates with the target location file, so that the raster coded value, raster row position and raster column position are not repeatedly stored as the target map sheet boundary changes, and generates the target map sheet coding result by using the cell center coordinates and the raster coded value, thereby improving the positioning and adaptation efficiency of standard map sheet grid coded data in different target map sheets. In summary, this invention reduces the amount of repetitive encoding processing and improves the efficiency of cross-target map sheet positioning adaptation by reusing the minimum encoding matrix and separating and pairing the basic encoding raster with the target positioning file. Attached Figure Description
[0008] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0009] Figure 1 A flowchart of a coding calculation method based on hierarchical grid optimization provided by the present invention. Detailed Implementation
[0010] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0011] Please see Figure 1 As shown in the figure, this embodiment discloses a coding calculation method based on hierarchical grid optimization, the method comprising: S11: Collect hierarchical grid parameters and target map sheet positioning data. The hierarchical grid parameters include hierarchical segmentation code, number of hierarchical rows, number of hierarchical columns and hierarchical span value, and generate a minimum coding matrix based on hierarchical segmentation code, number of hierarchical rows and number of hierarchical columns.
[0012] In one specific embodiment, the hierarchical grid parameters are obtained by reading the spatial identity coding rule file, the BeiDou grid location code segmentation rule file, or the basic geographic entity spatial identity coding configuration file. The hierarchical partitioning code is the coded code element corresponding to each matrix unit in the same level. The number of rows in the level is the number of matrix rows obtained by dividing the same level along the row direction. The number of columns in the level is the number of matrix columns obtained by dividing the same level along the column direction. The level span value is the spatial span corresponding to a single coded unit in the same level.
[0013] It should be noted that if the hierarchical span value is expressed in degrees, minutes, and seconds in the spatial identity coding rule file, the hierarchical span value should be converted into arcseconds before being included in the calculation.
[0014] For example, when the layer span value is 1′×1′, it is converted to 60″×60″; when the layer span value is 12″×12″, it remains 12″×12″. The symbol “″” represents arcseconds. If the target map sheet positioning data uses projected coordinate units, the layer span value is read or converted according to the same projected coordinate units, so that the target map sheet positioning data and the layer span value use the same coordinate units.
[0015] The target map location data includes the target map number, the coordinates of the left boundary of the target map, the coordinates of the lower boundary of the target map, the coordinates of the right boundary of the target map, and the coordinates of the upper boundary of the target map.
[0016] In one specific embodiment, the target map sheet location data is obtained by reading the standard map sheet index file, the spatial identity code map sheet index file, or the surveying and mapping result map sheet range file. The left and right boundary coordinates of the target map sheet are the column-oriented boundary coordinates of the target map sheet, while the lower and upper boundary coordinates of the target map sheet are the row-oriented boundary coordinates of the target map sheet. The target map sheet number is used to distinguish different target map sheets. The subsequent target map sheet span value, target location file and target map sheet coding result are all written according to the target map sheet number.
[0017] Specifically, the steps to generate the minimum encoding matrix are as follows: S111: Construct the matrix row positions and matrix column positions based on the number of rows and columns in the hierarchy.
[0018] In a specific embodiment, the number of hierarchical rows is represented as: The number of hierarchical columns is expressed as The row order of the matrix is represented as: ; in, The row position of the matrix. This represents the number of rows in the hierarchy.
[0019] The column order of a matrix is represented as follows: ; in, For the column order of the matrix, This represents the number of columns in the hierarchy.
[0020] It should be noted that the matrix row positions increase from top to bottom, and the matrix column positions increase from left to right. If the spatial identity encoding rule file specifies the opposite arrangement direction, then the matrix row and column positions are constructed according to the arrangement direction in the spatial identity encoding rule file, and maintain the same arrangement direction in the matrix cell order, raster row position, raster column position, and target location file.
[0021] For example, if a certain level has 5 rows and 5 columns, then the row positions of the matrix are 1 to 5, and the column positions of the matrix are 1 to 5, corresponding to 25 matrix units.
[0022] S112: Construct the order of matrix elements according to the row and column positions of the matrix.
[0023] In one specific embodiment, the matrix elements are constructed in row-major order. The matrix element order is represented as follows: ; in, row position of the matrix and matrix column order The corresponding matrix element order, This represents the number of columns in the hierarchy.
[0024] For example, when the number of rows and columns in a level is 5, the matrix cell with row position 1 and column position 1 is in order of 1; the matrix cell with row position 1 and column position 5 is in order of 5; the matrix cell with row position 2 and column position 1 is in order of 6. Thus, the 25 matrix cells are written in row-major order from 1 to 25.
[0025] When the spatial identity encoding rule file specifies that the hierarchical partition code is written in column-major order, the matrix element order is represented as follows: ; in, This refers to the number of rows in the hierarchy. Only one matrix unit order construction method is used in the same target map area encoding task.
[0026] S113: Write the hierarchical partitioning code into the corresponding matrix cell according to the matrix cell order to generate the matrix cell encoding value.
[0027] In one specific embodiment, the hierarchical partitioning code is represented in the order of the spatial identity encoding rule file as follows: ; in, For hierarchical partitioning, For matrix element order The corresponding encoded code elements, For the number of rows in the hierarchy, This represents the number of columns in the hierarchy.
[0028] The matrix unit encoding value is represented as: ; in, row position of the matrix and matrix column order The corresponding matrix unit encoding value, For matrix element order The corresponding encoded code elements.
[0029] It should be noted that the number of encoded code elements in the hierarchical partitioning code should be equal to the product of the number of rows and columns in the hierarchy. When the number of encoded code elements is not equal to the product of the number of rows and columns in the hierarchy, stop writing the matrix unit encoding value and record the hierarchical partitioning code quantity abnormality flag.
[0030] For example, if a certain level has 5 rows and 5 columns, then the level partitioning code should have 25 coding elements. The 25 coding elements are written into a 5x5 matrix cell according to the matrix cell order to obtain 25 matrix cell coding values.
[0031] S114: Arrange the matrix unit encoding values according to the matrix row position and matrix column position to generate the minimum encoding matrix.
[0032] In a specific embodiment, the minimum coding matrix is represented as: ; in, To be the minimum encoding matrix, The encoded value of the matrix unit. For the number of rows in the hierarchy, This represents the number of columns in the hierarchy.
[0033] It should be noted that the minimum coding matrix records the coding distribution pattern of the hierarchical subdivision code under the constraints of the number of rows and columns of the hierarchical level. It does not include the target map sheet number, the coordinates of the left boundary of the target map sheet, the coordinates of the lower boundary of the target map sheet, the coordinates of the right boundary of the target map sheet, and the coordinates of the upper boundary of the target map sheet. When different target map sheets have the same coding distribution pattern at the same level, the same minimum coding matrix can be reused.
[0034] S12: Calculate the target map sheet span value using the target map sheet location data and the layer span value, and generate the number of rows and columns of the matrix based on the target map sheet span value, the layer span value, and the minimum coding matrix.
[0035] In one specific embodiment, the target map span value is used to characterize the coverage area of the target map in the row and column directions, and the number of rows and columns of the matrix tiling are used to characterize the number of times the minimum coding matrix is repeatedly written along the row and column directions. Both the number of rows and columns of the matrix tiling are positive integers.
[0036] Specifically, the steps for calculating the target map sheet span value are as follows: S121: Calculate the column-direction target map sheet span value based on the coordinates of the right boundary and the left boundary of the target map sheet.
[0037] In a specific embodiment, the column-oriented target map span value is expressed as: ; in, This represents the target map span value. The coordinates of the right boundary of the target map sheet. The coordinates are the left boundary coordinates of the target map sheet.
[0038] It should be noted that the coordinates of the right boundary and the left boundary of the target map sheet use the same coordinate unit. When the coordinates of the right boundary of the target map sheet are less than or equal to the coordinates of the left boundary of the target map sheet, the calculation of the column-direction span value of the target map sheet is stopped, and the column-direction boundary anomaly indicator of the target map sheet is recorded.
[0039] S122: Calculate the row-direction target map span value based on the coordinates of the upper and lower boundaries of the target map sheet.
[0040] In a specific embodiment, the row-oriented target map span value is expressed as: ; in, This represents the target map span value. The coordinates of the upper boundary of the target map sheet. The coordinates are the lower boundary coordinates of the target map sheet.
[0041] It should be noted that the coordinates of the upper and lower boundaries of the target map sheet use the same coordinate unit. When the coordinates of the upper boundary of the target map sheet are less than or equal to the coordinates of the lower boundary of the target map sheet, the calculation of the row-direction target map sheet span value is stopped, and the abnormality indicator of the row-direction boundary of the target map sheet is recorded.
[0042] S123: Write the target map sheet span values in the row direction and column direction into the span data according to the target map sheet number to generate the target map sheet span value.
[0043] In a specific embodiment, the target map span value is expressed as: ; in, The target map span value, Number the target map sheet. This represents the target map span value. This represents the span value of the target map sheet in the column direction.
[0044] For example, when the left boundary coordinate of the target map sheet is 0″, the right boundary coordinate is 3600″, the lower boundary coordinate is 0″, and the upper boundary coordinate is 3600″, the column-direction target map sheet span is 3600″, and the row-direction target map sheet span is 3600″. The target map sheet span value is written according to the target map sheet number. .
[0045] Specifically, the steps to generate the number of rows and columns of a tiled matrix are as follows: S124: Decompose the hierarchical span value to obtain the hierarchical row span value and the hierarchical column span value.
[0046] In a specific embodiment, the hierarchical span value is represented as: ; in, This represents the hierarchical span value. This represents the row span value of the hierarchy. This represents the column span value of the hierarchy.
[0047] It should be noted that when the hierarchical span value is saved in the spatial identity encoding rule file in the format of "row span × column span", the hierarchical row span value and hierarchical column span value can be obtained directly by splitting them. When the hierarchical span value is stored as a single value and the row span and column span are the same, the hierarchical span value is used as the hierarchical row span value and the hierarchical column span value, respectively.
[0048] For example, if the level span is 1′×1′, then the level row span is 60″ and the level column span is 60″; if the level span is 12″×12″, then the level row span is 12″ and the level column span is 12″.
[0049] S125: Count the row positions of the minimum coding matrix to generate the number of row positions, and count the column positions to generate the number of column positions.
[0050] In a specific embodiment, the number of row positions in the matrix is represented as: ; in, This represents the number of row positions in the matrix. This represents the number of rows in the hierarchy.
[0051] The number of column positions in a matrix is expressed as: ; in, The number of column positions in the matrix. This represents the number of columns in the hierarchy.
[0052] It should be noted that the number of row positions in a matrix is obtained by counting the number of row positions, and the number of column positions in a matrix is obtained by counting the number of column positions. Since the row positions of a matrix are constructed from the number of rows in the hierarchy, and the column positions of a matrix are constructed from the number of columns in the hierarchy, the number of row positions in a matrix is the same as the number of rows in the hierarchy, and the number of column positions in a matrix is the same as the number of columns in the hierarchy.
[0053] S126: Multiply the number of row positions in the matrix by the row span value of the hierarchy to generate the row coverage span value of the matrix, and multiply the number of column positions in the matrix by the column span value of the hierarchy to generate the column coverage span value of the matrix.
[0054] In a specific embodiment, the matrix row coverage span value is represented as: ; in, This represents the row span value of the matrix. This represents the number of row positions in the matrix. This represents the row span value of the hierarchy.
[0055] The matrix column coverage span value is expressed as: ; in, For the column-direction coverage span value of the matrix, The number of column positions in the matrix. This represents the column span value of the hierarchy.
[0056] It should be noted that: the number of matrix row positions is a dimensionless number, the hierarchical row span is a spatial length value, and the matrix row coverage span is a spatial length value; the number of matrix column positions is a dimensionless number, the hierarchical column span is a spatial length value, and the matrix column coverage span is a spatial length value.
[0057] For example, if a certain level has 5 rows and 5 columns, and the row span and column span are both 60″, then the matrix row coverage span is 300″ and the matrix column coverage span is 300″. This result indicates that a minimum coding matrix has a row coverage of 300″ and a column coverage of 300″.
[0058] S127: Calculate the number of row-direction tiling references based on the target map sheet span value and the matrix row-direction coverage span value, and calculate the number of column-direction tiling references based on the target map sheet span value and the matrix column-direction coverage span value.
[0059] In one specific embodiment, in order to ensure that the complete coded raster covers the target map area, the division result is rounded up.
[0060] The number of rows for tiling is expressed as follows: ; in, The base quantity for row-direction tiling. This represents the target map span value. This represents the row span value of the matrix. The rounding up symbol.
[0061] The number of column-oriented tile references is expressed as follows: ; in, For the reference quantity of the column-oriented flat tiles, This represents the target map span value. This represents the column coverage span value of the matrix.
[0062] It should be noted that both the target map span value and the matrix row coverage span value are spatial length quantities, and the result of the division is a dimensionless quantity;
[0063] Both the target map span value and the matrix column coverage span value are spatial length quantities, and the result of their division is a dimensionless quantity.
[0064] For example, if the target map span is 3600″ and the matrix row coverage span is 300″, then the number of row tiling references is: The target map span is 3600″, and the matrix column coverage span is 300″. Therefore, the number of column-directed tiling references is... .
[0065] S128: Use the number of row-direction tiling references as the number of matrix tiling rows and the number of column-direction tiling references as the number of matrix tiling columns to generate the number of matrix tiling rows and the number of matrix tiling columns.
[0066] In a specific embodiment, the number of rows in a matrix tiled is represented as: ; in, To determine the number of rows in a matrix, This is the baseline quantity for row-wise tiling.
[0067] The number of columns in a matrix is expressed as: ; in, To determine the number of columns in a matrix, The reference quantity for column-oriented tiling.
[0068] It should be noted that the number of rows and columns of the matrix tiling are generated by the target map span value, the layer span value, and the minimum coding matrix. Subsequent complete coding rasters use the minimum coding matrix as the repeating tiling unit.
[0069] S13: Generate a complete coded raster based on the minimum coded matrix, the number of rows and columns of the matrix, and write the complete coded raster into the base coded raster of unfixed geographic coordinates.
[0070] In one specific embodiment, the complete coded raster is obtained by repeatedly writing the minimum coded matrix according to the number of rows and columns of the matrix tiling; The complete coded raster saves the raster code value, raster row position, and raster column position, but does not save the coordinates of the left boundary, lower boundary, right boundary, and upper boundary of the target map sheet. The base coded raster without fixed geographic coordinates is generated from the non-coordinate written data of the complete coded raster, so that the same coding distribution pattern can be called by different target map sheets.
[0071] Specifically, the steps to generate a complete coded raster are as follows: S131: Generate tiled input data based on the minimum coding matrix, the coding value of the matrix unit, the row position of the matrix, and the column position of the matrix.
[0072] In a specific embodiment, the tiled input data is represented as follows: ; in, To input data for tiling, To be the minimum encoding matrix, The encoded value of the matrix unit. The row position of the matrix. This refers to the column order of the matrix.
[0073] It should be noted that the matrix cell encoding value, matrix row position, and matrix column position are generated by S111 to S114. The target map sheet number and target map sheet boundary coordinates are not written into the tiled input data.
[0074] S132: Construct the row-wise tiling position based on the number of rows in the matrix, and construct the column-wise tiling position based on the number of columns in the matrix.
[0075] In a specific embodiment, the number of rows in a tiling matrix is represented as: The number of columns in a matrix is expressed as The row-direction tile position is represented as follows: ; in, The row-to-row tiling position. The number of rows in the matrix.
[0076] The column-to-floor tile position is represented as follows: ; in, For column-to-column tiling positions, This represents the number of columns in the matrix.
[0077] For example, when the number of rows and columns of the matrix is 12, the row tiling positions are 1 to 12, and the column tiling positions are 1 to 12. Each row tiling position and column tiling position corresponds to a minimum encoding matrix writing position.
[0078] S133: Calculate the raster row position and raster column position based on the matrix row position, matrix column position, row tiling position, and column tiling position.
[0079] In a specific embodiment, the grid row position is represented as follows: ; in, For the row position of the grid, The row-to-row tiling position. For the number of rows in the hierarchy, This represents the row position of the matrix.
[0080] The grid column position is represented as follows: ; in, For grid column order, For column-to-column tiling positions, For the number of columns in the hierarchy, This refers to the column order of the matrix.
[0081] It should be noted that the number of rows and columns in a hierarchy are dimensionless quantities, while the position of a matrix row, the position of a matrix column, the position of a row tile, the position of a column tile, the position of a grid row, and the position of a grid column are all positional quantities. Therefore, the dimensions on both sides of the above formula are consistent.
[0082] For example, if the number of rows in the hierarchy is 5, the number of columns in the hierarchy is 5, the row tiling position is 2, the column tiling position is 3, the matrix row position is 4, and the matrix column position is 2, then the raster row position is... The grid column position is .
[0083] S134: Write the matrix cell encoding value into the corresponding raster cell according to the raster row position and raster column position to generate a complete encoded raster, and use the matrix cell encoding value written into the corresponding raster cell as the raster encoding value.
[0084] In one specific embodiment, the raster code value is represented as: ; in, For grid row positions Grid column order The corresponding raster code value, row position of the matrix Matrix column order The corresponding matrix unit encoding value.
[0085] The complete coded raster is represented as: ; in, For a complete coded raster, For the row position of the grid, For grid column order, This is the raster-coded value.
[0086] For example, when the number of rows in the hierarchy is 5, the number of columns in the hierarchy is 5, the number of rows in the matrix tiling is 12, and the number of columns in the matrix tiling is 12, the complete coded raster has 60 raster row positions and 60 raster column positions, for a total of 3600 raster units; The raster code value of each raster cell is obtained by repeatedly writing the matrix cell code value at the corresponding position.
[0087] Specifically, the steps for writing the complete coded raster into the base coded raster of unfixed geographic coordinates are as follows: S135: Filter non-coordinate data to be written based on raster code value, raster row position, and raster column position.
[0088] In a specific embodiment, non-coordinate written data is represented as follows: ; in, Write data for non-coordinates. For the row position of the grid, For grid column order, This is the raster-coded value.
[0089] It should be noted that the non-coordinate data written does not include the target map sheet number, the coordinates of the left boundary of the target map sheet, the coordinates of the lower boundary of the target map sheet, the coordinates of the right boundary of the target map sheet, and the coordinates of the upper boundary of the target map sheet. The geolocation content of the target map sheet will be saved in the subsequent target location file.
[0090] S136: Construct basic raster index data based on the hierarchical segmentation code, the number of hierarchical rows, the number of hierarchical columns, the number of matrix tiling rows, the number of matrix tiling columns, the raster code value, the raster row position, and the raster column position.
[0091] In one specific embodiment, the basic raster index data is used to identify the same coded distribution pattern and the same tile size. The basic raster index data can be generated by a hash function, such as the SHA-256 function, the SM3 function, or a one-way hash function commonly used in the field of file verification.
[0092] Specifically, the steps for constructing the basic raster index data are as follows: S136.1: Construct a matrix structure identifier based on the hierarchical partitioning code, the number of rows in the hierarchy, and the number of columns in the hierarchy.
[0093] In a specific embodiment, the matrix structure identifier is represented as: ; in, As a matrix structure identifier, For hash functions, For hierarchical partitioning, For the number of rows in the hierarchy, This represents the number of columns in the hierarchy.
[0094] S136.2: Construct a tile size identifier based on the number of rows and columns of the tiled matrix.
[0095] In one specific embodiment, the tile size identifier is represented as follows: ; in, For flat tile size markings, To determine the number of rows in a matrix, This represents the number of columns in the matrix.
[0096] S136.3: Input the matrix structure identifier, tile size identifier, raster code value, raster row position, and raster column position into the hash function to generate basic raster index data.
[0097] In one specific embodiment, the raster row position, raster column position, and raster code value are input into the hash function in ascending order of raster row position, and then in ascending order of raster column position within the same raster row position. The basic raster index data is represented as follows: ; in, Based on the raster index data, As a matrix structure identifier, For flat tile size markings, For the row position of the grid, For grid column order, This is the raster-coded value.
[0098] It should be noted that when multiple raster cells exist, all raster row positions, raster column positions, and raster code values are written into the hash function in a fixed order. This fixed order is determined by the raster row and column positions and is not affected by the target map sheet number.
[0099] S137: Based on the basic raster index data, retrieve the basic raster storage position to obtain the basic raster write position.
[0100] In one specific embodiment, the basic raster storage position is provided by a basic raster index file or a spatial database index table; The basic raster index data is compared with the index content in the basic raster index file; if the same basic raster index data exists, the corresponding basic raster storage position is read as the basic raster write position. If no identical base raster index data exists, a new base raster storage position is allocated in the base raster index file, and the new base raster storage position is used as the base raster write position.
[0101] It should be noted that the basic raster storage position can be the file offset position, the database primary key number, or the object storage path number.
[0102] S138: Write the non-coordinate data into the base coded raster according to the base raster writing position to generate a base coded raster with unfixed geographic coordinates.
[0103] In one specific embodiment, the underlying coded raster of unfixed geographic coordinates is represented as follows: ; in, The base coded raster for unfixed geographic coordinates, Based on the raster index data, Write data for non-coordinates.
[0104] It should be noted that the base coded raster of unfixed geographic coordinates does not save the target map sheet boundary coordinates. For different target map sheets with the same base raster index data, geographic positioning can be completed by regenerating the target positioning file.
[0105] S14: Calculate the cell center coordinates using the target map sheet location data and the layer span value, write the cell center coordinates into the target location file, bind the base coding raster, and generate the target map sheet coding result.
[0106] In one specific embodiment, the pixel center coordinates are the center position corresponding to each raster code value within the target map sheet coordinate range. The target positioning file stores the target map sheet number, raster row position, raster column position, and pixel center coordinates. The target map sheet encoding result is obtained by pairing the pixel center coordinates and raster code values according to the same target map sheet number, the same raster row position, and the same raster column position.
[0107] Specifically, the steps for generating the target map sheet encoding result are as follows: S141: Construct positioning calculation data based on the target map sheet number, the left boundary coordinates of the target map sheet, the upper boundary coordinates of the target map sheet, the row span value of the layer, the column span value of the layer, the row position of the raster, and the column position of the raster.
[0108] In a specific embodiment, the location calculation data is represented as follows: ; in, To locate and calculate data, Number the target map sheet. The coordinates of the left boundary of the target map sheet. The coordinates of the upper boundary of the target map sheet. This represents the row span value of the hierarchy. This represents the column span value of the hierarchy. For the row position of the grid, For the grid column position.
[0109] It should be noted that the coordinates of the left boundary of the target map sheet, the coordinates of the upper boundary of the target map sheet, the row span value of the level, and the column span value of the level all use the same coordinate unit.
[0110] S142: Calculate the horizontal coordinates of the pixel center based on the raster column position, the layer column span value, and the coordinates of the left boundary of the target map sheet.
[0111] Specifically, the steps for calculating the horizontal coordinates of the pixel center are as follows: S142.1: Calculate the left boundary offset of the column based on the grid column position and the column span value of the hierarchy.
[0112] In a specific embodiment, the column offset to the left boundary is expressed as: ; in, This is the column offset to the left boundary. For grid column order, This represents the column span value of the hierarchy.
[0113] S142.2: Calculate the column-direction half-cell offset based on the column-direction span value of the hierarchy.
[0114] In a specific embodiment, the column-to-half cell offset is represented as: ; in, This is the column-to-column half-cell offset. This represents the column span value of the hierarchy.
[0115] S142.3: Overlay the column-to-left boundary offset, the column-to-half-cell offset, and the target map sheet left boundary coordinates to generate the pixel center horizontal coordinates.
[0116] In a specific embodiment, the lateral coordinate of the pixel center is represented as: ; in, The horizontal coordinate of the pixel center The coordinates of the left boundary of the target map sheet. This is the column offset to the left boundary. This is the column-to-column half-cell offset.
[0117] For example, if the left boundary coordinate of the target map sheet is 0″, the column span value is 60″, the grid column position is 1, then the column left boundary offset is 0″, the column half-cell offset is 30″, and the pixel center horizontal coordinate is 30″. When the grid column position is 2, the column offset to the left boundary is 60″, and the horizontal coordinate of the cell center is 90″.
[0118] S143: Calculate the vertical coordinates of the pixel center based on the raster row position, the layer row span value, and the upper boundary coordinates of the target map sheet.
[0119] In a specific embodiment, the row upward boundary offset is represented as: ; in, This is the offset of the row to the upper boundary. For the row position of the grid, This represents the row span value of the hierarchy.
[0120] The row-to-row half-cell offset is expressed as: ; in, This is the half-cell offset in the row direction. This represents the row span value of the hierarchy.
[0121] The vertical coordinate of the pixel center is represented as: ; in, The vertical coordinate of the pixel center The coordinates of the upper boundary of the target map sheet. This is the offset of the row to the upper boundary. This is the half-cell offset in the row direction.
[0122] It should be noted that in this embodiment, the grid row position increases from top to bottom. Therefore, the vertical coordinate of the pixel center is calculated by subtracting the row offset from the upper boundary of the target map and the row offset from the half-cell offset.
[0123] S144: Use the horizontal and vertical coordinates of the pixel center as the pixel center coordinates, and write the pixel center coordinates into the target positioning file according to the target map sheet number, raster row position, and raster column position.
[0124] In a specific embodiment, the pixel center coordinates are represented as: ; in, For grid row positions Grid column order The corresponding pixel center coordinates, The horizontal coordinate of the pixel center The vertical coordinate of the pixel center.
[0125] The content written in the target location file is represented as follows: ; in, Locate the target file. Number the target map sheet. For the row position of the grid, For grid column order, These are the coordinates of the pixel center.
[0126] S145: Pair the pixel center coordinates and raster code values according to the target map sheet number, raster row position, and raster column position to generate the target map sheet code result.
[0127] In a specific embodiment, the target map sheet encoding result is represented as follows: ; in, The encoding result for the target map sheet, Number the target map sheet. For the row position of the grid, For grid column order, The coordinates of the pixel center This is the raster-coded value.
[0128] For example, a target map sheet numbered as follows: The raster row position is 1, the raster column position is 1, and the cell center coordinates are... The corresponding raster code value is The target map sheet encoding result is then written as... When another target map has the same raster code value and the same raster position, the pixel center coordinates only need to be regenerated based on the left boundary coordinates and the upper boundary coordinates of the target map.
[0129] The above embodiments are only used to illustrate the technical methods of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical methods of the present invention without departing from the spirit and scope of the technical methods of the present invention.
Claims
1. A coding calculation method based on hierarchical grid optimization, characterized in that, The method includes: Collect hierarchical grid parameters and target map sheet positioning data. The hierarchical grid parameters include hierarchical segmentation code, number of hierarchical rows, number of hierarchical columns and hierarchical span value, and generate a minimum coding matrix based on hierarchical segmentation code, number of hierarchical rows and number of hierarchical columns. The target map sheet span value is calculated using the target map sheet location data and the hierarchical span value. Based on the target map sheet span value, the hierarchical span value, and the minimum coding matrix, the number of rows and columns of the matrix are generated. A complete coded raster is generated based on the minimum coded matrix, the number of rows in the matrix tiling, and the number of columns in the matrix tiling, and the complete coded raster is written into the base coded raster of unfixed geographic coordinates; The pixel center coordinates are calculated using the target map sheet location data and the layer span value. After the pixel center coordinates are written into the target location file, they are bound to the basic coding raster to generate the target map sheet coding result.
2. The coding calculation method based on hierarchical grid optimization according to claim 1, characterized in that, The target map location data includes the target map number, the coordinates of the left boundary of the target map, the coordinates of the lower boundary of the target map, the coordinates of the right boundary of the target map, and the coordinates of the upper boundary of the target map.
3. The encoding calculation method based on hierarchical grid optimization according to claim 2, characterized in that, The steps to generate the minimum encoding matrix are as follows: Construct the matrix row positions and matrix column positions based on the number of rows and columns in the hierarchy, respectively; Construct the order of matrix elements according to the row and column positions of the matrix; The hierarchical partitioning code is written into the corresponding matrix unit according to the matrix unit order to generate the matrix unit encoding value; Arrange the matrix unit encoding values according to the matrix row position and matrix column position to generate the minimum encoding matrix.
4. The encoding calculation method based on hierarchical grid optimization according to claim 3, characterized in that, The steps for calculating the target map sheet span value are as follows: Calculate the column-oriented span value of the target map sheet based on the coordinates of the right boundary and the left boundary of the target map sheet; Calculate the row-direction target map span value based on the coordinates of the upper and lower boundaries of the target map sheet; Write the target map sheet span values in the row direction and column direction into the span data according to the target map sheet number to generate the target map sheet span value.
5. The encoding calculation method based on hierarchical grid optimization according to claim 4, characterized in that, The steps to generate the number of rows and columns of a tiled matrix are as follows: The hierarchical span value is split into the hierarchical row span value and the hierarchical column span value; Count the row positions of the minimum coding matrix to generate the number of row positions, and count the column positions to generate the number of column positions. Multiply the number of row positions in the matrix by the row span value of the hierarchy to generate the row coverage span value of the matrix, and multiply the number of column positions in the matrix by the column span value of the hierarchy to generate the column coverage span value of the matrix. Calculate the number of row-direction tiling references based on the target map sheet span value and the matrix row-direction coverage span value, and calculate the number of column-direction tiling references based on the target map sheet span value and the matrix column-direction coverage span value. The number of rows as the tiling reference is used as the number of rows in the matrix, and the number of columns as the tiling reference is used as the number of columns in the matrix, thus generating the number of rows and columns in the matrix.
6. The coding calculation method based on hierarchical grid optimization according to claim 5, characterized in that, The steps to generate a complete coded raster are as follows: Based on the minimum coding matrix, the coding value of the matrix unit, the row position of the matrix, and the column position of the matrix, generate the tiled input data; Based on the number of rows in the matrix, construct the row-wise tiling positions, and based on the number of columns in the matrix, construct the column-wise tiling positions. Calculate the raster row position and raster column position based on the matrix row position, matrix column position, row tiling position, and column tiling position; The matrix cell encoding value is written into the corresponding raster cell according to the raster row position and raster column position to generate a complete encoded raster, and the matrix cell encoding value written into the corresponding raster cell is used as the raster encoding value.
7. The coding calculation method based on hierarchical grid optimization according to claim 6, characterized in that, The steps to write a complete coded raster into a base coded raster of unfixed geographic coordinates are as follows: Filter non-coordinate data to write based on raster code value, raster row position, and raster column position; The basic raster index data is constructed based on the hierarchical partition code, the number of hierarchical rows, the number of hierarchical columns, the number of matrix tiling rows, the number of matrix tiling columns, the raster code value, the raster row position, and the raster column position. Based on the basic raster index data, retrieve the basic raster storage position to obtain the basic raster write position; Non-coordinate data is written into the base coded raster according to the base raster writing position, generating a base coded raster with unfixed geographic coordinates.
8. The coding calculation method based on hierarchical grid optimization according to claim 7, characterized in that, The steps to construct the basic raster index data are as follows: Construct a matrix structure identifier based on the hierarchical partitioning code, the number of rows in the hierarchy, and the number of columns in the hierarchy; Construct a tile size identifier based on the number of rows and columns of the tiled matrix; Input the matrix structure identifier, tile size identifier, raster code value, raster row position, and raster column position into the hash function to generate basic raster index data.
9. The coding calculation method based on hierarchical grid optimization according to claim 8, characterized in that, The steps to generate the target map sheet encoding result are as follows: Based on the target map sheet number, the coordinates of the left boundary of the target map sheet, the coordinates of the upper boundary of the target map sheet, the row span value of the hierarchy, the column span value of the hierarchy, the row position of the raster, and the column position of the raster, location calculation data is constructed; Calculate the horizontal coordinates of the pixel center based on the raster column position, the layer column span value, and the coordinates of the left boundary of the target map sheet; Calculate the vertical coordinates of the cell center based on the raster row position, the layer row span value, and the upper boundary coordinates of the target map sheet; The horizontal and vertical coordinates of the pixel center are used as the pixel center coordinates, and the pixel center coordinates are written into the target positioning file according to the target map sheet number, raster row position, and raster column position. The pixel center coordinates and raster code values are paired according to the target map sheet number, raster row position, and raster column position to generate the target map sheet code result.
10. The coding calculation method based on hierarchical grid optimization according to claim 9, characterized in that, The steps to calculate the lateral coordinates of the pixel center are as follows: Calculate the column offset to the left boundary based on the grid column position and the column span value of the hierarchy; Calculate the column-wise half-cell offset based on the column span value of the hierarchy; The left-to-column offset, the half-cell offset, and the left-to-column coordinates of the target map are superimposed to generate the horizontal coordinates of the pixel center.