Raster map data storage method and device
By merging tile data and adopting a reasonable file structure, the problem of low storage efficiency of raster map data in the existing technology is solved, and lightweight, efficient storage and fast retrieval are achieved.
Patent Information
- Application Number
- CN202310787470.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-29
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2043-06-29
AI Technical Summary
Existing raster map data storage solutions cannot achieve lightweight storage of data, and cannot fundamentally reduce the number of small files stored, resulting in low storage, reading, and management efficiency.
By determining the number of layers to be merged in the raster map tile pyramid model to be stored, the tile data are merged and saved in the corresponding storage subdirectory, and the merged file structure is used to reduce the number of files and optimize index retrieval, using Store level and top-level tile coordinates for file naming to improve retrieval speed.
It achieves lightweight and efficient storage of raster map data, reduces I/O operation frequency, increases reading speed, simplifies management and operation, and significantly reduces storage space and the number of files.
Smart Images

Figure CN116842013B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of raster map data storage, and in particular to a raster map data storage method and device. Background Art
[0002] Raster map refers to a way of representing maps using rasters. It is a two-dimensional matrix composed of pixels. Each pixel represents a small piece of land or some specific geographic data, such as elevation, temperature, land type, population density, etc. Raster map data is the data that converts geographic spatial information into a grid composed of pixel points.
[0003] Raster maps are usually used in fields such as satellite images, remote sensing images, and meteorological data. Due to the continuous advancement of modern satellite remote sensing technology, the resolution and accuracy of raster maps are also constantly improving, so they have been widely used in the field of geographic information systems (GIS). Raster maps have the advantages of data preprocessing, fast data loading, and adaptability to different levels, and are particularly suitable for the application scenarios of network map servers. Correspondingly, there are also the following problems:
[0004] 1. Large storage space is occupied: Since raster map data is divided and stored in the form of tiles, the number of files will increase dramatically in the case of high-resolution or large-scale maps, thus occupying a large amount of storage space.
[0005] 2. Frequent I / O operations: Raster map data is stored in the form of a large number of small files. This will result in frequent disk I / O operations when searching for a file in a large number of small files, thus affecting the data reading speed.
[0006] 3. Difficulty in index management: Since raster map data is stored in the form of a large number of small files, index management becomes very difficult and requires specific index strategies and storage solutions for management and maintenance.
[0007] 4. Distributed storage has great pressure: In distributed storage management, the storage format of raster map data leads to the existence of a large number of small files, which will bring great pressure to the main node management, thus affecting the performance of the entire system.
[0008] In order to solve the above problems caused by too many small files due to the storage format of raster map data, which leads to many problems in data storage, reading, management, and migration, researchers have proposed some solutions:
[0009] One solution is tile map storage based on oracle data files. Its characteristics are: first, by converting tile maps into oracle data files, optimizing the conversion and storage methods, and improving the efficiency of data conversion and tile map reading; second, a hierarchical storage method is adopted. According to the hierarchical structure characteristics of tile maps, different database users, table spaces and their corresponding data files are established according to the hierarchy, and tiles are inserted into the corresponding layers; when reading tiles, by establishing bitmap indexes, tile maps can be quickly queried and located, and layer-related views are created, and mapping relationships between file hierarchies are established, which greatly improves the query and reading efficiency of files. Although this technology can optimize data storage and improve query efficiency to a certain extent with the help of oracle database, its shortcomings are also obvious: the storage of raster map tile data files depends on oracle and cannot be lightweight; and the oracle database must be queried to obtain tile data, and the database query speed has a bottleneck.
[0010] The second solution is to use two compact files, one of which stores the location and length information of the raster map in another large file, while the other large file stores the information of the original raster map. This can greatly reduce the number of small files, improve processing efficiency, and reduce storage costs. This technology solves the problem of too many small files to a large extent, but the disadvantage is that the number of index files and aggregation files is equivalent, and new small files are added while reducing the number of raster map files.
[0011] In summary, the current raster data storage solutions, while improving the data storage and reading efficiency to a certain extent, cannot achieve lightweight data storage, and cannot fundamentally reduce the number of small files stored, and still have not overcome the technical difficulties faced by raster map data in storage, reading, management, and migration. Summary of the invention
[0012] The embodiment of the present invention provides a raster map data storage method and device for solving the following technical problems: the current raster data storage solution cannot realize lightweight storage of data and cannot fundamentally reduce the number of small files stored.
[0013] The embodiment of the present invention adopts the following technical solutions:
[0014] In one aspect, an embodiment of the present invention provides a method for storing raster map data, the method comprising: determining the number of layers to be merged of a raster map tile pyramid model to be stored;
[0015] Determine one or more storage level intervals according to the number of layers to be merged;
[0016] According to the storage level interval, create a corresponding storage directory;
[0017] Starting from the first tile data layer in each storage level interval, merging tile data of the lower tile data layers in turn, and saving the obtained merged data file in the corresponding storage subdirectory; wherein the storage subdirectory is a subdirectory of the storage directory;
[0018] According to the query information of the target tile data, the target tile data is located in the storage directory and obtained.
[0019] In a feasible implementation manner, determining the number of layers to be merged in the raster map tile pyramid model to be stored specifically includes:
[0020] Get the zoom level of the raster map data to be stored;
[0021] Use the raster map image with the lowest zoom level and the smallest map scale as the top layer of the pyramid;
[0022] The raster map image at the top layer of the pyramid is divided into 2×2 pixels per pixel to generate a first layer tile matrix; and so on, until the raster map image with the highest zoom level is generated, the last layer tile matrix is obtained, and a complete raster map tile pyramid model to be stored is formed;
[0023] Obtain the total number of layers and non-display layers of the raster map tile pyramid model to be stored;
[0024] The number of layers of the non-display layer is subtracted from the total number of layers to obtain the number of layers to be merged in the grid map tile pyramid model to be stored.
[0025] In a feasible implementation manner, one or more storage level intervals are determined according to the number of layers to be merged, specifically including:
[0026] When the number of layers to be merged is less than or equal to a preset threshold, all layers to be merged are classified into one storage level interval;
[0027] When the number of layers to be merged is greater than a preset threshold, all layers to be merged are evenly distributed to multiple storage level intervals, so that the number of layers in each storage level interval is less than or equal to the preset threshold.
[0028] In a feasible implementation, creating a corresponding storage directory according to the storage level interval specifically includes:
[0029] Create a corresponding storage directory for each storage level interval;
[0030] The storage directory is named according to the storage level interval.
[0031] In a feasible implementation, starting from the first tile data layer in each storage level interval, merging tile data for the lower tile data layers in turn, and saving the merged tile data files in the corresponding storage subdirectory, specifically includes:
[0032] Get the tile coordinate range in the first layer of tile data layer in the current storage level interval; the tile coordinate range includes the horizontal coordinate range [TileX1, TileX n ], and the vertical coordinate range [TileY1, TileY n ];
[0033] According to the horizontal coordinate in the tile coordinate range, create a corresponding storage subdirectory in a subordinate directory of the storage directory;
[0034] The minimum coordinate point in the tile coordinate range is determined, and starting from the tile corresponding to the minimum coordinate point, the tile data is merged in sequence to the lower tile data layers, and the merged tile data file is saved in the corresponding storage subdirectory.
[0035] In a feasible implementation, determining the minimum coordinate point in the tile coordinate range, merging tile data with the lower tile data layer starting from the minimum coordinate point, and saving the obtained merged data file in the corresponding storage subdirectory specifically includes:
[0036] Create a storage subdirectory named TileX1 in the storage directory corresponding to the current storage level interval;
[0037] In the TileX1 storage subdirectory, create two subdirectories named TileY n Named TileY n .dat merged data file;
[0038] In the range of tile data layers contained in the current storage level interval, traverse all tiles with a horizontal coordinate of TileX1 in the first layer of tile data layers, respectively (TileX1, TileY n ) is the starting point for merging, and all tile data within the current storage level range are merged from the upper layer of the pyramid to the lower layer, and the resulting merged data file is saved to the corresponding TileY n .dat merged data file;
[0039] Among them, the total number of tile data files contained in each merged data file is N is the number of tile data layers contained in the current storage level interval;
[0040] Continue to create a storage subdirectory named TileX2 and repeat the tile data merging process, and so on, until the horizontal axis is TileX n All tile data are merged.
[0041] In a feasible implementation manner, the merged data file includes an index segment and a data segment;
[0042] The index segment stores the location index information of each merged tile data; the data segment stores the tile data length information and the original tile data information; each location index information and each tile data length information are stored in 4-byte space.
[0043] In a feasible implementation manner, locating and acquiring the target tile data in the storage directory according to the query information of the target tile data specifically includes:
[0044] Obtain the target layer where the target tile data is located and the target tile coordinates (x, y) from the query information;
[0045] Determine, according to the target layer, a storage level interval to which the target tile data belongs, and determine, according to the storage level interval, a storage directory corresponding to the target tile data;
[0046] Determine, according to the storage directory and the target tile coordinates, a storage path of a merged data file of the target tile data and position index information in the merged data file; wherein the position index information includes at least an index number;
[0047] The target tile data is read from the merged data file according to the position index information.
[0048] In a feasible implementation manner, determining the storage path of the merged data file of the target tile data and the position index information in the merged data file according to the storage directory and the target tile coordinates specifically includes:
[0049] Determine the topmost data layer bz according to the storage level interval to which the target tile data belongs;
[0050] according to Determine a storage subdirectory corresponding to the merged data file where the target tile data is located;
[0051] according to Determine the merged data file name Q.dat where the target tile data is located;
[0052] Determine a storage path of a merged data file of the target tile data according to the storage directory corresponding to the target tile data, the storage subdirectory P, and the merged data file name Q.dat;
[0053] according to Determine the index number of the target tile data in the merged data file;
[0054] in, Indicates the minimum value of the horizontal coordinate in the target layer;
[0055] Indicates the maximum value of the horizontal coordinate in the target layer;
[0056] Indicates the minimum vertical coordinate value in the target layer.
[0057] On the other hand, an embodiment of the present invention further provides a raster map data storage device, the device comprising:
[0058] at least one processor; and a memory in communication with the at least one processor; wherein,
[0059] The memory stores instructions that can be executed by the at least one processor, so that the at least one processor can execute a raster map data storage method according to any of the above embodiments.
[0060] The embodiment of the present invention provides a lightweight and efficient storage algorithm for raster map data. Through this algorithm, a large number of small raster map data files are merged into a large data file through a more reasonable organization method, and the index retrieval method is optimized, so that I / O operations are greatly reduced, the reading speed is greatly improved, the management and operation are more convenient, and the storage space of the file is greatly reduced. At the same time, the present invention uses the storage level and the top tile coordinates TileX and TileY for file naming, and stores the data position index in the merged file with fixed rules, which greatly improves the retrieval speed of the map tile. The present invention stores aggregated tile data in a small pyramid mode. When one of the tile data is requested, the index position of the tile in this small pyramid model is first calculated, and then the data position is obtained in the aggregated file, and finally the original data of the tile is obtained. This storage method can improve the retrieval efficiency, and the tile amount of each aggregated file is larger and the aggregation is more thorough. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0062] Figure 1 A flow chart of a grid map data storage method provided by an embodiment of the present invention;
[0063] Figure 2 A schematic diagram of a storage directory provided by an embodiment of the present invention;
[0064] Figure 3 A schematic diagram of a tile data merging rule provided by an embodiment of the present invention;
[0065] Figure 4 A schematic diagram of a merged data file structure provided by an embodiment of the present invention;
[0066] Figure 5 A schematic diagram of a target tile data query provided by an embodiment of the present invention;
[0067] Figure 6 A schematic diagram of the structure of a raster map data storage device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0068] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0069] In view of the defects of the above technologies, an embodiment of the present invention provides a raster map data storage method, which aggregates multiple layers of small files into a large data file through a more reasonable organization method, and optimizes the index storage method, so that I / O operations are greatly reduced and management is more convenient.
[0070] Figure 1 A flow chart of a method for storing grid map data provided by an embodiment of the present invention is as follows: Figure 1 As shown, the grid map data storage method specifically includes steps S101-S105:
[0071] S101, determining the number of layers to be merged in the raster map tile pyramid model to be stored.
[0072] Specifically, the zoom level of the raster map data to be stored is obtained. The raster map image with the lowest zoom level and the smallest map scale is used as the top layer of the pyramid. The raster map image at the top layer of the pyramid is divided into 2×2 pixels per pixel to generate the first layer of tile matrix; and so on, until the raster map image with the highest zoom level is generated, and the last layer of tile matrix is obtained, forming a complete raster map tile pyramid model to be stored.
[0073] As a feasible implementation method, the raster tile map pyramid model is a multi-resolution hierarchical model. From the bottom to the top of the tile pyramid, the resolution is getting lower and lower, but the represented geographical range remains unchanged. First, determine the number of zoom levels to be provided by the map service platform, and take the map image with the lowest zoom level and the smallest map scale as the top layer of the pyramid, that is, the 0th layer; based on the 0th layer map image, generate the first layer map image by dividing each pixel into 2×2 pixels, and divide it into blocks, and divide it into square map tiles of the same size as the next layer to form the first layer tile matrix; use the same method to generate the second layer tile matrix, and so on until the last layer, forming the entire tile pyramid model. The tile data in each layer of tile map can be represented by the raster map tile coordinate system. In the coordinate system, the world map is divided into map units of 256×256 pixels by cutting. Each map unit is called a map tile, and each tile has a unique identifier to identify its position in the map. A tile at a certain zoom level is composed of 4 tiles cut from the tile at the lower level, forming a tile pyramid.
[0074] Further, the total number of layers and non-display layers of the raster map tile pyramid model to be stored is obtained, and the number of layers of the non-display layers is subtracted from the total number of layers to obtain the number of layers to be merged of the raster map tile pyramid model to be stored.
[0075] In one embodiment, in an existing grid tile map, the pyramid model has 19 layers from 0 to 18, and layers 0 to 1 are non-display layers and are not displayed, so layers 2 to 18 are layers to be merged and need to be processed by file merging and storage.
[0076] S102: Determine one or more storage level intervals according to the number of layers to be merged.
[0077] Specifically, when the number of layers to be merged is less than or equal to a preset threshold, all layers to be merged are classified into one storage level interval. When the number of layers to be merged is greater than the preset threshold, all layers to be merged are evenly distributed to multiple storage level intervals, so that the number of layers in each storage level interval is less than or equal to the preset threshold.
[0078] As a feasible implementation method, if the number of layers to be merged is less than or equal to 9, they can be directly classified into one storage level interval; if the number of layers to be merged is greater than 9, it is recommended to divide the storage level into multiple intervals and evenly distribute the tile data layers from top to bottom.
[0079] In one embodiment, if the layers to be merged are 2-9 layers, with a total of 8 layers, which is less than 9 layers, then layers 2-9 can be classified into the same interval. If the layers to be merged are 2-18 layers, with a total of 17 layers, which is greater than 9 layers, then in order to evenly distribute the data layers, they can be divided into two storage level intervals, namely 2-10 layers and 10-18 layers.
[0080] S103. Create a corresponding storage directory according to the storage level interval.
[0081] Specifically, a corresponding storage directory is created for each storage level interval; wherein the storage directory is named after the storage level interval.
[0082] As a feasible implementation, respective storage directories are created according to the storage level intervals determined in S102.
[0083] In one embodiment, Figure 2 A schematic diagram of a storage directory provided by an embodiment of the present invention, such as Figure 2 As shown in the figure, if the two storage level intervals are 2-10 and 10-18 respectively, two directories "2-10" and "10-18" are created.
[0084] S104 , starting from the first tile data layer in each storage level interval, sequentially merge tile data for the lower tile data layers, and save the obtained merged data file in the corresponding storage subdirectory.
[0085] Specifically, obtain the tile coordinate range in the first layer of tile data layer in the current storage level interval; the tile coordinate range includes the horizontal coordinate range [TileX1, TileX n ], and the vertical coordinate range [TileY1, TileY n ].
[0086] Furthermore, according to the horizontal coordinate in the tile coordinate range, a corresponding storage subdirectory is created in the lower directory of the storage directory. Then the minimum coordinate point in the tile coordinate range is determined, and starting from the tile corresponding to the minimum coordinate point, the tile data is merged in sequence to the lower tile data layer, and the merged tile data file is saved in the corresponding storage subdirectory.
[0087] Furthermore, in the storage directory corresponding to the current storage level interval, create a storage subdirectory named TileX1. In the TileX1 storage subdirectory, create two subdirectories named TileY n Named TileY n .dat merged data file. In the range of tile data layers contained in the current storage level interval, traverse all tiles with a horizontal coordinate of TileX1 in the first layer of tile data layers, respectively (TileX1, TileY n ) is the starting point for merging, and all tile data within the current storage level range are merged from the upper layer of the pyramid to the lower layer, and the resulting merged data file is saved to the corresponding TileY n .dat merged data file. The total number of tile data files contained in each merged data file is N is the number of tile data layers contained in the current storage level interval.
[0088] As a feasible implementation, the storage hierarchy is represented by StoreZ, and the storage hierarchy from top to bottom is: StoreZ1, StoreZ2, ..., StoreZ n . Start processing from StoreZ1 and get the tile coordinate range of the tile data layer in StoreZ1, such as the X coordinate value range [TileX1, TileX n ], and the Y coordinate range: [TileY1, TileY n ] and start merging tile data from the minimum point (TileX1, TileY1).
[0089] The specific merger rules and procedures are as follows:
[0090] 1) Starting from TileX1, create a directory named after the TileX1 value under the storage directory;
[0091] 2) In the TileX1 directory, create a merged data file named TileY1.dat;
[0092] 3) In the storage level range, take (TileX1, TileY1) as the pyramid vertex and merge all tile data in this range from top to bottom;
[0093] 4) Repeat steps 2 and 3 until all tile data corresponding to TileX1 are merged;
[0094] 5) Repeat steps 1-4 until TileX n All corresponding tile data are merged.
[0095] In one embodiment, Figure 3 A schematic diagram of a tile data merging rule provided by an embodiment of the present invention is shown in FIG. Figure 3 The range shown is 2-10 storage levels. Processing starts from 2-10 storage levels to obtain the coordinate range of all tiles that need to be processed in the second layer. For example, if the X coordinate value range is 1-10 and the Y coordinate range is 1-10, the tile data is merged starting from the minimum point (1, 1). Figure 3 Only the smallest point in the second layer is shown in FIG, and the other points are not shown). Then starting from TileX=1, first Figure 2 Create a subdirectory named "1" under the 2-10 storage directory in the , and further obtain the minimum TileY value, which is 1, then create a merged data file 1.dat named "1" under the created "1" directory. Then, take the minimum point (1,1) of the z=2nd layer tile as the pyramid vertex, merge all tile data in the 2-10 layer range from top to bottom into one data file, and save it to 1.dat. Since there are 9 layers in 2-10, the number of tile data stored in each merged file dat is
[0096] In one embodiment, after all the lower-layer tile data corresponding to the tile (1,1) in the second layer are merged and saved in 1.dat, a merged data file 2.dat named "2" is created in the 1 directory in the 2-10 storage directory. Then, with the point (1,2) of the second-layer tile as the pyramid vertex, all tile data within the range of 2-10 layers are merged into one data file from top to bottom and saved in 2.dat. Repeat the above process until all tiles with a horizontal coordinate of 1 in the second layer are merged.
[0097] Further, continue to create a storage subdirectory named TileX2 and repeat the tile data merging process, and so on, until the horizontal axis is TileX2. n All tile data are merged.
[0098] In one embodiment, after all tiles with abscissa 1 in the second layer are merged, a subdirectory named "2" is created under the 2-10 storage directory, and the tile data with abscissa 2 is merged in sequence according to the above merging process. By analogy, all merged files are generated with (1,2), (1,3) ... (10,10) as pyramid vertices, until all tile data in storage levels 2-10 are merged.
[0099] The merged data file includes an index segment and a data segment. Among them, the index segment stores the location index information of each merged tile data; the data segment stores the tile data length information and the original tile data information; each location index information and each tile data length information are stored in a 4-byte space.
[0100] As a feasible implementation manner, Figure 4 This is a schematic diagram of the structure of the merged data file provided by the embodiment of the present invention. As Figure 4 shown, the content of the merged data file includes two regions, an index segment and a data segment. Among them, the index segment stores the location index information of each merged tile data in a 4-byte space, while the data segment stores the tile data length and the original tile data information, and the tile data length information is also stored in a 4-byte space.
[0101] S105. Locate and obtain the target tile data in the storage directory according to the query information of the target tile data.
[0102] Specifically, obtain the target layer z and the target tile coordinates (x, y) where the target tile data is located in the query information. According to the target layer, determine the storage level interval to which the target tile data belongs, and according to the storage level interval, determine the storage directory corresponding to the target tile data.
[0103] In one embodiment, define bz as the topmost data layer in the storage level interval where the queried tile is located. When 2 <= z <= 10, bz = 2, and the corresponding storage directory is "2-10"; when 10 < z <= 18, bz = 10, and the corresponding storage directory is "10-18".
[0104] Furthermore, according to the storage directory and the target tile coordinates, determine the storage path of the merged data file of the target tile data and the location index information in the merged data file; among them, the location index information includes at least the index number.
[0105] As a feasible implementation manner, according to determine the storage sub-directory corresponding to the merged data file where the target tile data is located. According to determine the merged data file name Q.dat where the target tile data is located. According to the storage directory, storage sub-directory P, and merged data file name Q.dat corresponding to the target tile data, determine the storage path of the merged data file of the target tile data.
[0106] In one embodiment, if the target layer z is 7, the storage path of the merged data file of the target tile data is 2-10\P\Q.dat.
[0107] As a feasible implementation manner, according to Determine the index number of the target tile data in the merged data file. Indicates the minimum horizontal coordinate value in the target layer. Indicates the maximum horizontal coordinate value in the target layer; Indicates the minimum vertical coordinate value in the target layer.
[0108] Furthermore, according to the position index information, the target tile data is read from the merged data file.
[0109] In one embodiment, Figure 5 A schematic diagram of a target tile data query provided by an embodiment of the present invention is shown in FIG. Figure 5 As shown, the target layer z=12, so the top layer bz=10. From the figure, we can see that bx=1, by=1, ex=4, and the coordinates of the target tile are (3,4), that is, x=3, y=4. Substituting the above parameters into formula S, we can get S=20. The index number of the target tile data is 20. According to the index number, the length information of the target tile data can be obtained in the data segment of 10-18\P\Q.dat, and then according to the length information, the tile data of the length can be read after the length information, so as to read out the target tile data.
[0110] The grid map data storage method provided by the embodiment of the present invention reorganizes the grid map tile data by merging files, which greatly reduces the number of files and avoids the time consumption caused by frequent I / O operations. At the same time, small files are merged and stored, which greatly reduces the storage space of the files. At the same time, the present invention uses the storage level and the top tile coordinates TileX and TileY for file naming, and stores the data position index in the merged file with fixed rules, which greatly improves the retrieval speed of map tiles. The present invention stores aggregated tile data in the mode of a small pyramid. When requesting one of the tile data, the index position of the tile in this small pyramid model is first calculated, and then the data position is obtained in the aggregated file, and finally the original data of the tile is obtained. This storage method can improve the retrieval efficiency, and the tile amount of each aggregated file is larger and the aggregation is more thorough.
[0111] In addition, the embodiment of the present invention also provides a grid map data storage device, such as Figure 6 As shown, the raster map data storage device specifically includes:
[0112] at least one processor; and a memory in communication with the at least one processor; wherein,
[0113] The memory stores instructions executable by at least one processor to enable the at least one processor to perform:
[0114] Determine the number of layers to be merged in the raster map tile pyramid model to be stored;
[0115] Determine one or more storage level intervals according to the number of layers to be merged;
[0116] According to the storage level interval, create a corresponding storage directory;
[0117] Starting from the first tile data layer in each storage level interval, merging tile data of the lower tile data layers in turn, and saving the obtained merged data file in the corresponding storage subdirectory; wherein the storage subdirectory is a subdirectory of the storage directory;
[0118] According to the query information of the target tile data, the target tile data is located in the storage directory and obtained.
[0119] The various embodiments of the present invention are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0120] The above describes specific embodiments of the present invention. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0121] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for storing raster map data, characterized in that: The method comprises: Determine the number of layers to be merged in the raster map tile pyramid model to be stored; Determine one or more storage level intervals according to the number of layers to be merged; According to the storage level interval, create a corresponding storage directory; Starting from the first tile data layer in each storage level interval, merging tile data of the lower tile data layers in turn, and saving the obtained merged data file in the corresponding storage subdirectory; wherein the storage subdirectory is a subdirectory of the storage directory; According to the query information of the target tile data, locating and acquiring the target tile data in the storage directory specifically includes: Obtaining the target layer where the target tile data is located and the target tile coordinates (x, y) from the query information; determining the storage level interval to which the target tile data belongs according to the target layer, and determining the storage directory corresponding to the target tile data according to the storage level interval; Determine, according to the storage directory and the target tile coordinates, a storage path of a merged data file of the target tile data and position index information in the merged data file; wherein the position index information at least includes an index number; and read the target tile data in the merged data file according to the position index information; Wherein, determining the storage path of the merged data file of the target tile data and the position index information in the merged data file according to the storage directory and the target tile coordinates specifically includes: Determine the topmost data layer bz according to the storage level interval to which the target tile data belongs; according to Determine a storage subdirectory corresponding to the merged data file where the target tile data is located; according to Determine the merged data file name Q.dat where the target tile data is located; Determine a storage path of a merged data file of the target tile data according to the storage directory corresponding to the target tile data, the storage subdirectory P, and the merged data file name Q.dat; according to Determine the index number of the target tile data in the merged data file; in, Indicates the minimum value of the horizontal coordinate in the target layer; Indicates the maximum value of the horizontal coordinate in the target layer; Indicates the minimum vertical coordinate value in the target layer.
2. A method for storing raster map data according to claim 1, characterized in that: Determine the number of layers to be merged in the raster map tile pyramid model to be stored, including: Get the zoom level of the raster map data to be stored; Use the raster map image with the lowest zoom level and the smallest map scale as the top layer of the pyramid; The raster map image at the top layer of the pyramid is divided into 2×2 pixels per pixel to generate a first layer tile matrix; and so on, until the raster map image with the highest zoom level is generated, the last layer tile matrix is obtained, and a complete raster map tile pyramid model to be stored is formed; Obtain the total number of layers and non-display layers of the raster map tile pyramid model to be stored; The number of layers of the non-display layer is subtracted from the total number of layers to obtain the number of layers to be merged in the grid map tile pyramid model to be stored.
3. A method for storing raster map data according to claim 1, characterized in that: According to the number of layers to be merged, one or more storage level intervals are determined, specifically including: When the number of layers to be merged is less than or equal to a preset threshold, all layers to be merged are classified into one storage level interval; When the number of layers to be merged is greater than a preset threshold, all layers to be merged are evenly distributed to multiple storage level intervals, so that the number of layers in each storage level interval is less than or equal to the preset threshold.
4. A method for storing grid map data according to claim 1, characterized in that: According to the storage level interval, create a corresponding storage directory, specifically including: Create a corresponding storage directory for each storage level interval; The storage directory is named according to the storage level interval.
5. A method for storing grid map data according to claim 1, characterized in that: Starting from the first tile data layer in each storage level interval, tile data is merged in the lower tile data layers in turn, and the merged tile data files are saved in the corresponding storage subdirectory, including: Get the tile coordinate range in the first layer of tile data layer in the current storage level interval; the tile coordinate range includes the horizontal coordinate range [TileX1, TileX n ], and the vertical coordinate range [TileY1, TileY n ]; According to the horizontal coordinate in the tile coordinate range, create a corresponding storage subdirectory in a subordinate directory of the storage directory; The minimum coordinate point in the tile coordinate range is determined, and starting from the tile corresponding to the minimum coordinate point, the tile data is merged in sequence to the lower tile data layers, and the merged tile data file is saved in the corresponding storage subdirectory.
6. A method for storing grid map data according to claim 5, characterized in that: Determine the minimum coordinate point in the tile coordinate range, and merge tile data with the lower tile data layer starting from the minimum coordinate point, and save the obtained merged data file in the corresponding storage subdirectory, specifically including: Create a storage subdirectory named TileX1 in the storage directory corresponding to the current storage level interval; In the TileX1 storage subdirectory, create two subdirectories named TileY n Named TileY n .dat merged data file; In the range of tile data layers contained in the current storage level interval, traverse all tiles with a horizontal coordinate of TileX1 in the first layer of tile data layers, respectively (TileX1, TileY n ) is the starting point for merging, and all tile data within the current storage level range are merged from the upper layer of the pyramid to the lower layer, and the resulting merged data file is saved to the corresponding TileY n .dat merged data file; Among them, the total number of tile data files contained in each merged data file is N is the number of tile data layers contained in the current storage level interval; Continue to create a storage subdirectory named TileX2 and repeat the tile data merging process, and so on, until the horizontal axis is TileX n All tile data are merged.
7. A method for storing grid map data according to claim 6, characterized in that: The merged data file includes an index segment and a data segment; The index segment stores the location index information of each merged tile data; the data segment stores the tile data length information and the original tile data information; each location index information and each tile data length information are stored in 4-byte space.
8. A raster map data storage device, characterized in that: The device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, so that the at least one processor can execute a raster map data storage method according to any one of claims 1-7.
Citation Information
Patent Citations
Map tile storage method based on MBTiles
CN109492060A
Tile map storage method based on oracle data files
CN112131333A
Data storage system and method based on high-precision map
CN114238538A
Object-level image query and retrieval
US20190147047A1
Rapid image calibration and real-time rendering method and system, medium, and mobile end
WO2022184185A2
